(get_cred_cache): figure out principal
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6251 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -226,11 +226,21 @@ get_cred_cache(krb5_context context,
|
|||||||
|
|
||||||
if(client == NULL)
|
if(client == NULL)
|
||||||
client = default_client;
|
client = default_client;
|
||||||
if(client == NULL)
|
if(client == NULL) {
|
||||||
/* client_name not passed, and
|
char *user;
|
||||||
couldn't get principal from cache */
|
struct passwd *pw;
|
||||||
return -1;
|
user = getlogin();
|
||||||
|
if(user == NULL) {
|
||||||
|
pw = getpwuid(getuid());
|
||||||
|
user = pw->pw_name;
|
||||||
|
}
|
||||||
|
if(user == NULL)
|
||||||
|
return KADM5_FAILURE;
|
||||||
|
ret = krb5_make_principal(context, &client,
|
||||||
|
NULL, user, "admin", NULL);
|
||||||
|
if(ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
if(client != default_client) {
|
if(client != default_client) {
|
||||||
krb5_free_principal(context, default_client);
|
krb5_free_principal(context, default_client);
|
||||||
default_client = NULL;
|
default_client = NULL;
|
||||||
|
Reference in New Issue
Block a user