* alt_prof.c (kadm5_get_config_params): When KADM5_CONFIG_ENCTYPES
authorEzra Peisach <epeisach@mit.edu>
Mon, 13 Oct 1997 14:52:01 +0000 (14:52 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 13 Oct 1997 14:52:01 +0000 (14:52 +0000)
           is set on the input parameters, allocate a new copy of the
           key_salts for the output parameters.
(kadm5_free_config_params): Free the admin_server and admin_lockfile
   names.

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

src/lib/kadm5/ChangeLog
src/lib/kadm5/alt_prof.c

index 321168b95386142b7a21875e07e1697a183249a0..d929b033368d0fa99212a508ef564d329b8844af 100644 (file)
@@ -1,3 +1,11 @@
+Mon Oct 13 10:48:24 1997  Ezra Peisach  <epeisach@mit.edu>
+
+       * alt_prof.c (kadm5_get_config_params): When KADM5_CONFIG_ENCTYPES
+           is set on the input parameters, allocate a new copy of the
+           key_salts for the output parameters.
+       (kadm5_free_config_params): Free the admin_server and admin_lockfile
+          names. 
+
 Tue Oct  7 07:48:12 1997  Ezra Peisach  <epeisach@mit.edu>
 
        * logger.c: Include ctype.h for isspace definition.
index 247050d493f5044e48680d556bfb32871fd4bbba..b1b07c5b520f14988547cc51ba49cfad620513b0 100644 (file)
 #include <stdio.h>
 #include <ctype.h>
 
+
+static krb5_key_salt_tuple *copy_key_salt_tuple(ksalt, len)
+krb5_key_salt_tuple *ksalt;
+krb5_int32 len;
+{
+    int i;
+    krb5_key_salt_tuple *knew;    
+
+    if(len == 0) return 0;
+    if((knew = (krb5_key_salt_tuple *)
+               malloc((len ) * sizeof(krb5_key_salt_tuple)))) {
+         memcpy(knew, ksalt, len * sizeof(krb5_key_salt_tuple));
+        return knew;
+    }
+    return 0;
+}
+
 /*
  * krb5_aprof_init()   - Initialize alternate profile context.
  *
@@ -590,9 +607,12 @@ krb5_error_code kadm5_get_config_params(context, kdcprofile, kdcenv,
     /* Get the value for the supported enctype/salttype matrix */
     hierarchy[2] = "supported_enctypes";
     if (params_in->mask & KADM5_CONFIG_ENCTYPES) {
-        params.mask |= KADM5_CONFIG_ENCTYPES;
-        params.keysalts = params_in->keysalts;
-        params.num_keysalts = params_in->num_keysalts;
+        params.keysalts = copy_key_salt_tuple(params_in->keysalts, 
+                                              params_in->num_keysalts);
+        if(params.keysalts) {
+            params.mask |= KADM5_CONFIG_ENCTYPES;
+            params.num_keysalts = params_in->num_keysalts;
+        }
     } else {
         svalue = NULL;
         if (aprofile)
@@ -645,6 +665,8 @@ kadm5_free_config_params(context, params)
            krb5_xfree(params->stash_file);
        if (params->keysalts)
            krb5_xfree(params->keysalts);
+       if (params->admin_server)
+            free(params->admin_server);
        if (params->admin_keytab)
             free(params->admin_keytab);
        if (params->dict_file)
@@ -655,6 +677,9 @@ kadm5_free_config_params(context, params)
             free(params->realm);
        if (params->admin_dbname)
             free(params->admin_dbname);
+       if (params->admin_lockfile)
+            free(params->admin_lockfile);
+
     }
     return(0);
 }