Don't assume that the request server's realm name is null terminated.
authorTheodore Tso <tytso@mit.edu>
Fri, 14 Oct 1994 04:31:01 +0000 (04:31 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 14 Oct 1994 04:31:01 +0000 (04:31 +0000)
Compare the request server against changepw/kerberos using
krb5_principal_compare.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4504 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/ChangeLog
src/kdc/do_as_req.c

index 10e8e1ac441d15a84cc20add453e41e40648e3c2..165b404a9b232f710934d79787d01092ba6bb1cb 100644 (file)
@@ -1,3 +1,10 @@
+Tue Oct 11 22:11:09 1994  Theodore Y. Ts'o  (tytso@dcl)
+
+       * do_as_req.c (process_as_req): Don't assume that the request
+               server's realm name is null terminated.  Compare the
+               request server against changepw/kerberos using
+               krb5_principal_compare.
+
 Tue Oct  4 16:42:16 1994  Theodore Y. Ts'o  (tytso@dcl)
 
        * kdc_util.c (kdc_rdreq_keyproc): Add widen.h and narrow.h around
index 82a968f8d6a27cb3d5d502821c5ea0b877196ce5..138bdcebf11fed665a69eab9defe327635077add 100644 (file)
@@ -132,6 +132,7 @@ krb5_data **response;                       /* filled in with a response packet */
     krb5_enctype useetype;
     krb5_pa_data *padat_tmp[2], padat_local;
     krb5_data salt_data;
+    static krb5_principal cpw = 0;
     char *status;
 
     register int i;
@@ -173,9 +174,16 @@ krb5_data **response;                      /* filled in with a response packet */
      * site-specific policiy file....
      */
     pwreq = 0;
-    sprintf(cpw_service, "%s@%s", "changepw/kerberos", 
-           krb5_princ_realm(request->server)->data);
-    if (strcmp(sname, cpw_service) == 0) pwreq++;
+    if (!cpw) {
+           retval = krb5_parse_name("changepw/kerberos", &cpw);
+           if (retval)
+                   goto errout;
+           free(krb5_princ_realm(cpw)->data);
+           krb5_princ_realm(cpw)->data = 0;
+    }
+    krb5_princ_realm(cpw)->data = krb5_princ_realm(request->server)->data;
+    if (krb5_principal_compare(request->server, cpw))
+           pwreq++;
 
     c_nprincs = 1;
     if (retval = krb5_db_get_principal(request->client, &client, &c_nprincs,