svn rev #21776: trunk/src/kadmin/server/

ghudson@MIT.EDU ghudson at MIT.EDU
Thu Jan 22 14:19:35 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21776
Commit By: ghudson
Log Message:
ticket: 6284
status: open

Adapted patch from Apple: in kadmind's process_chpw_request, make sure
to free error message strings.



Changed Files:
U   trunk/src/kadmin/server/schpw.c
Modified: trunk/src/kadmin/server/schpw.c
===================================================================
--- trunk/src/kadmin/server/schpw.c	2009-01-22 06:34:14 UTC (rev 21775)
+++ trunk/src/kadmin/server/schpw.c	2009-01-22 19:19:34 UTC (rev 21776)
@@ -39,6 +39,7 @@
     int numresult;
     char strresult[1024];
     char *clientstr = NULL, *targetstr = NULL;
+    const char *errmsg = NULL;
     size_t clen;
     char *cdots;
     struct sockaddr_storage ss;
@@ -244,6 +245,8 @@
     ret = schpw_util_wrapper(server_handle, client, target,
 			     (ticket->enc_part2->flags & TKT_FLG_INITIAL) != 0,
 			     ptr, NULL, strresult, sizeof(strresult));
+    if (ret)
+	errmsg = krb5_get_error_message(context, ret);
 
     /* zap the password */
     memset(clear.data, 0, clear.length);
@@ -307,12 +310,12 @@
 			 addrbuf,
 			 (int) clen, clientstr, cdots,
 			 (int) tlen, targetp, tdots,
-			 ret ? krb5_get_error_message (context, ret) : "success");
+			 errmsg ? errmsg : "success");
     } else {
 	krb5_klog_syslog(LOG_NOTICE, "chpw request from %s for %.*s%s: %s",
 			 addrbuf,
 			 (int) clen, clientstr, cdots,
-			 ret ? krb5_get_error_message (context, ret) : "success");
+			 errmsg ? errmsg : "success");
     }
     switch (ret) {
     case KADM5_AUTH_CHANGEPW:
@@ -467,6 +470,8 @@
 	krb5_free_unparsed_name(context, targetstr);
     if (clientstr)
 	krb5_free_unparsed_name(context, clientstr);
+    if (errmsg)
+	krb5_free_error_message(context, errmsg);
 
     return(ret);
 }




More information about the cvs-krb5 mailing list