krb5_ccache cc;
krb5_principal princ;
kadm5_config_params params;
- char svcnamebuf[MAXHOSTNAMELEN + 8];
char *svcname;
memset((char *) ¶ms, 0, sizeof(params));
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;
+ svcname = NULL;
/*
* Set cc to an open credentials cache, either specified by the -c
* client_init.c (_kadm5_init_any)[DEBUG]: Print error from
clnttcp_create().
+ (_kadm5_init_any): Use kadm5_get_admin_service_name() if null
+ pointer passed in for service_name.
2004-06-15 Tom Yu <tlyu@mit.edu>
int code = 0;
generic_ret *r;
+ char svcname[MAXHOSTNAMELEN + 8];
initialize_ovk_error_table();
initialize_adb_error_table();
krb5_init_context(&handle->context);
- if(service_name == NULL || client_name == NULL) {
+ if(client_name == NULL) {
free(handle);
return EINVAL;
}
free(handle);
return KADM5_MISSING_KRB5_CONF_PARAMS;
}
-
+
+ /* NULL service_name means use host-based. */
+ if (service_name == NULL) {
+ code = kadm5_get_admin_service_name(handle->context,
+ handle->params.realm,
+ svcname, sizeof(svcname));
+ if (code) {
+ krb5_free_context(handle->context);
+ free(handle);
+ return KADM5_MISSING_KRB5_CONF_PARAMS;
+ }
+ service_name = svcname;
+ }
/*
* Acquire a service ticket for service_name@realm in the name of
* client_name, using password pass (which could be NULL), and