use host-based service name for kadmin client
authorTom Yu <tlyu@mit.edu>
Thu, 24 Jun 2004 20:10:05 +0000 (20:10 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 24 Jun 2004 20:10:05 +0000 (20:10 +0000)
* kadmin.c (kadmin_startup): Use host-based service name from
kadm5_get_admin_service_name() for SEAM compatibility when old
AUTH_GSSAPI not requested.

ticket: new
component: krb5-admin

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

src/kadmin/cli/ChangeLog
src/kadmin/cli/kadmin.c

index 4bfa4265253ca938c62e91be81340b3951151974..28502c6abc1a8db1eec9f5f887f8d8c3a9cfdb61 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-24  Tom Yu  <tlyu@mit.edu>
+
+       * kadmin.c (kadmin_startup): Use host-based service name from
+       kadm5_get_admin_service_name() for SEAM compatibility when old
+       AUTH_GSSAPI not requested.
+
 2004-06-15  Tom Yu  <tlyu@mit.edu>
 
        * kadmin.c (kadmin_startup): Add option to force old AUTH_GSSAPI
index 3eef8529b0226834120610c2713dd5a103053ca6..06d23b813d5d5c811773e73a94b235c29a5f068d 100644 (file)
@@ -183,6 +183,8 @@ char *kadmin_startup(argc, argv)
     krb5_ccache cc;
     krb5_principal princ;
     kadm5_config_params params;
+    char svcnamebuf[MAXHOSTNAMELEN + 8];
+    char *svcname;
 
     memset((char *) &params, 0, sizeof(params));
     
@@ -261,6 +263,17 @@ char *kadmin_startup(argc, argv)
     params.mask |= KADM5_CONFIG_REALM;
     params.realm = def_realm;
 
+    retval = kadm5_get_admin_service_name(context, def_realm, svcnamebuf,
+                                         sizeof(svcnamebuf));
+    if (retval) {
+       fprintf(stderr, "%s: failed to get admin service name", whoami);
+       exit(1);
+    }
+    if (params.mask & KADM5_CONFIG_OLD_AUTH_GSSAPI)
+       svcname = KADM5_ADMIN_SERVICE;
+    else
+       svcname = svcnamebuf;
+
     /*
      * Set cc to an open credentials cache, either specified by the -c
      * argument or the default.
@@ -404,7 +417,7 @@ char *kadmin_startup(argc, argv)
         printf("Authenticating as principal %s with existing credentials.\n",
                princstr);
         retval = kadm5_init_with_creds(princstr, cc,
-                                       KADM5_ADMIN_SERVICE
+                                       svcname
                                        &params,
                                        KADM5_STRUCT_VERSION,
                                        KADM5_API_VERSION_2,
@@ -417,7 +430,7 @@ char *kadmin_startup(argc, argv)
             printf("Authenticating as principal %s with default keytab.\n",
                    princstr);
         retval = kadm5_init_with_skey(princstr, keytab_name,
-                                      KADM5_ADMIN_SERVICE
+                                      svcname
                                       &params,
                                       KADM5_STRUCT_VERSION,
                                       KADM5_API_VERSION_2,
@@ -426,7 +439,7 @@ char *kadmin_startup(argc, argv)
         printf("Authenticating as principal %s with password.\n",
                princstr);
         retval = kadm5_init_with_password(princstr, password,
-                                          KADM5_ADMIN_SERVICE
+                                          svcname
                                           &params,
                                           KADM5_STRUCT_VERSION,
                                           KADM5_API_VERSION_2,