/*
* kdc/do_as_req.c
*
- * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991,2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
limit_string(sname);
c_nprincs = 1;
- if ((errcode = krb5_db_get_principal(kdc_context, request->client,
- &client, &c_nprincs, &more))) {
+ if ((errcode = get_principal(kdc_context, request->client,
+ &client, &c_nprincs, &more))) {
status = "LOOKING_UP_CLIENT";
c_nprincs = 0;
goto errout;
}
s_nprincs = 1;
- if ((errcode = krb5_db_get_principal(kdc_context, request->server, &server,
- &s_nprincs, &more))) {
+ if ((errcode = get_principal(kdc_context, request->server, &server,
+ &s_nprincs, &more))) {
status = "LOOKING_UP_SERVER";
goto errout;
}
header? */
nprincs = 1;
- if ((errcode = krb5_db_get_principal(kdc_context, request->server, &server,
- &nprincs, &more))) {
+ if ((errcode = get_principal(kdc_context, request->server, &server,
+ &nprincs, &more))) {
status = "LOOKING_UP_SERVER";
nprincs = 0;
goto cleanup;
tmp = *krb5_princ_realm(kdc_context, *pl2);
krb5_princ_set_realm(kdc_context, *pl2,
krb5_princ_realm(kdc_context, tgs_server));
- retval = krb5_db_get_principal(kdc_context, *pl2, server, nprincs, more);
+ retval = get_principal(kdc_context, *pl2, server, nprincs, more);
krb5_princ_set_realm(kdc_context, *pl2, &tmp);
if (retval) {
*nprincs = 0;
/*
* kdc/kdc_preauth.c
*
- * Copyright 1995, 2003 by the Massachusetts Institute of Technology.
+ * Copyright 1995, 2003, 2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
krb5_princ_component(kdc_context,newp,probeslot)->length =
strlen(sam_ptr->name);
npr = 1;
- retval = krb5_db_get_principal(kdc_context, newp, &assoc, &npr, &more);
+ retval = get_principal(kdc_context, newp, &assoc, &npr, &more);
if(!retval && npr) {
sc.sam_type = sam_ptr->sam_type;
break;
nprincs = 1;
- if ((retval = krb5_db_get_principal(kdc_context, ticket->server,
- &server, &nprincs,
- &more))) {
+ if ((retval = get_principal(kdc_context, ticket->server,
+ &server, &nprincs,
+ &more))) {
return(retval);
}
if (more) {
strcat(s, "}");
return;
}
+
+krb5_error_code
+get_principal_locked (krb5_context kcontext,
+ krb5_const_principal search_for,
+ krb5_db_entry *entries, int *nentries,
+ krb5_boolean *more)
+{
+ return krb5_db_get_principal (kcontext, search_for, entries, nentries,
+ more);
+}
+
+krb5_error_code
+get_principal (krb5_context kcontext,
+ krb5_const_principal search_for,
+ krb5_db_entry *entries, int *nentries, krb5_boolean *more)
+{
+ /* Eventually this will be used to manage locking while looking up
+ principals in the database. */
+ return get_principal_locked (kcontext, search_for, entries, nentries,
+ more);
+}
/*
* kdc/kdc_util.h
*
- * Copyright 1990 by the Massachusetts Institute of Technology.
+ * Copyright 1990, 2007 by the Massachusetts Institute of Technology.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
void kdc_insert_lookaside (krb5_data *, krb5_data *);
void kdc_free_lookaside(krb5_context);
+/* kdc_util.c */
+krb5_error_code
+get_principal_locked (krb5_context kcontext,
+ krb5_const_principal search_for,
+ krb5_db_entry *entries, int *nentries,
+ krb5_boolean *more);
+krb5_error_code
+get_principal (krb5_context kcontext,
+ krb5_const_principal search_for,
+ krb5_db_entry *entries, int *nentries, krb5_boolean *more);
+
#define isflagset(flagfield, flag) (flagfield & (flag))
#define setflag(flagfield, flag) (flagfield |= (flag))
#define clear(flagfield, flag) (flagfield &= ~(flag))
local_realm, &search)))
return(0);
- if ((retval = krb5_db_get_principal(kdc_context, search, &entries,
- &nprinc, &more5))) {
+ /* The krb4 support in the KDC is not thread-safe yet, so maintain
+ the global lock until that gets fixed. */
+ if ((retval = get_principal_locked(kdc_context, search, &entries,
+ &nprinc, &more5))) {
krb5_free_principal(kdc_context, search);
return(0);
}