Skip to content

Commit

Permalink
Print names for enumerated types
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed May 14, 2013
1 parent d1ca41b commit ce49341
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,17 @@ char *vp_aprint(TALLOC_CTX *ctx, VALUE_PAIR const *vp)
case PW_TYPE_BYTE:
case PW_TYPE_SHORT:
case PW_TYPE_INTEGER:
p = talloc_asprintf(ctx, "%u", vp->vp_integer);
{
DICT_VALUE *dv;

dv = dict_valbyattr(vp->da->attr, vp->da->vendor,
vp->vp_integer);
if (dv) {
p = talloc_strdup(ctx, dv->name);
} else {
p = talloc_asprintf(ctx, "%u", vp->vp_integer);
}
}
break;

case PW_TYPE_SIGNED:
Expand Down

0 comments on commit ce49341

Please sign in to comment.