summaryrefslogtreecommitdiffstats
path: root/src/clients/kpasswd
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2012-05-09 17:40:38 +0000
committerGreg Hudson <ghudson@mit.edu>2012-05-09 17:40:38 +0000
commit13a0013f55e9bea8384234f5caa1a0b444749daf (patch)
tree421085bed0a911b9a5de9ea06fbd401f37d5904b /src/clients/kpasswd
parentc250f6743a623ab5086c56324060ebf99c740379 (diff)
downloadkrb5-13a0013f55e9bea8384234f5caa1a0b444749daf.tar.gz
krb5-13a0013f55e9bea8384234f5caa1a0b444749daf.tar.xz
krb5-13a0013f55e9bea8384234f5caa1a0b444749daf.zip
Add API to interpret changepw result strings
Active Directory returns structured policy information in the nominally UTF-8 result string field of a password change reply. Add a new API krb5_chpw_message() to convert a result string into a displayable message, interpreting policy information if present. Patch from stefw@gnome.org with changes. ticket: 7128 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25857 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/clients/kpasswd')
-rw-r--r--src/clients/kpasswd/kpasswd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/clients/kpasswd/kpasswd.c b/src/clients/kpasswd/kpasswd.c
index b4b6eadd4d..7aed0f1ac8 100644
--- a/src/clients/kpasswd/kpasswd.c
+++ b/src/clients/kpasswd/kpasswd.c
@@ -53,6 +53,7 @@ int main(int argc, char *argv[])
krb5_ccache ccache;
krb5_get_init_creds_opt *opts = NULL;
krb5_creds creds;
+ char *message;
char pw[1024];
unsigned int pwlen;
@@ -154,11 +155,12 @@ int main(int argc, char *argv[])
}
if (result_code) {
- printf("%.*s%s%.*s\n",
+ if (krb5_chpw_message(context, &result_string, &message) != 0)
+ message = NULL;
+ printf("%.*s%s%s\n",
(int) result_code_string.length, result_code_string.data,
- result_string.length?": ":"",
- (int) result_string.length,
- result_string.data ? result_string.data : "");
+ message ? ": " : "", message ? message : NULL);
+ krb5_free_string(context, message);
krb5_get_init_creds_opt_free(context, opts);
exit(2);
}