implement krb5_get_server_rcache
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9288 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997-2000 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "krb5_locl.h"
|
#include "krb5_locl.h"
|
||||||
|
#include <vis.h>
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
@@ -84,6 +85,12 @@ krb5_rc_default_name(krb5_context context)
|
|||||||
return "FILE:/var/run/default_rcache";
|
return "FILE:/var/run/default_rcache";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
krb5_rc_default_type(krb5_context context)
|
||||||
|
{
|
||||||
|
return "FILE";
|
||||||
|
}
|
||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
krb5_rc_default(krb5_context context,
|
krb5_rc_default(krb5_context context,
|
||||||
krb5_rcache *id)
|
krb5_rcache *id)
|
||||||
@@ -211,6 +218,7 @@ krb5_rc_get_lifespan(krb5_context context,
|
|||||||
}
|
}
|
||||||
return KRB5_RC_IO_UNKNOWN;
|
return KRB5_RC_IO_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
krb5_rc_get_name(krb5_context context,
|
krb5_rc_get_name(krb5_context context,
|
||||||
krb5_rcache id)
|
krb5_rcache id)
|
||||||
@@ -225,3 +233,32 @@ krb5_rc_get_type(krb5_context context,
|
|||||||
return "FILE";
|
return "FILE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
krb5_error_code
|
||||||
|
krb5_get_server_rcache(krb5_context context,
|
||||||
|
const krb5_data *piece,
|
||||||
|
krb5_rcache *id)
|
||||||
|
{
|
||||||
|
krb5_rcache rcache;
|
||||||
|
krb5_error_code ret;
|
||||||
|
|
||||||
|
char *tmp = malloc(4 * piece->length + 1);
|
||||||
|
char *name;
|
||||||
|
if(tmp == NULL)
|
||||||
|
return ENOMEM;
|
||||||
|
strvisx(tmp, piece->data, piece->length, VIS_WHITE | VIS_OCTAL);
|
||||||
|
#ifdef HAVE_GETEUID
|
||||||
|
asprintf(&name, "FILE:rc_%s_%u", tmp, geteuid());
|
||||||
|
#else
|
||||||
|
asprintf(&name, "FILE:rc_%s", tmp);
|
||||||
|
#endif
|
||||||
|
free(tmp);
|
||||||
|
if(name == NULL)
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
ret = krb5_rc_resolve_full(context, &rcache, name);
|
||||||
|
free(name);
|
||||||
|
if(ret)
|
||||||
|
return ret;
|
||||||
|
*id = rcache;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user