summaryrefslogtreecommitdiff
path: root/source3/libads/kerberos_keytab.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-06-22 00:48:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:00 -0500
commite948458a79462bd99ef7c02b4d7ec22c6554a163 (patch)
tree29edf635292a7faaa4479cbb5cdd9d4d0d4607e2 /source3/libads/kerberos_keytab.c
parent5a889c9d7bd3d66d6bbb5d31eb320f2e2f555d60 (diff)
downloadsamba-e948458a79462bd99ef7c02b4d7ec22c6554a163.tar.gz
samba-e948458a79462bd99ef7c02b4d7ec22c6554a163.tar.bz2
samba-e948458a79462bd99ef7c02b4d7ec22c6554a163.zip
r1215: Intermediate checkin of the new keytab code. I need to make sure I
haven't broken krb5 ticket verification in the mainline code path, also need to check with valgrind. Everything now compiles (MIT, need to also check Heimdal) and the "net keytab" utility code will follow. Jeremy. (This used to be commit f0f2e28958cb9abfed216c71f291f19ea346d630)
Diffstat (limited to 'source3/libads/kerberos_keytab.c')
-rw-r--r--source3/libads/kerberos_keytab.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index dc25fb74c0..da504db363 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -30,26 +30,10 @@
#ifdef HAVE_KRB5
/**********************************************************************
- Converts a name to a fully qalified domain name.
-***********************************************************************/
-
-void name_to_fqdn(fstring fqdn, const char *name)
-{
- struct hostent *hp = sys_gethostbyname(name);
- if ( hp && hp->h_name && *hp->h_name ) {
- DEBUG(10,("name_to_fqdn: lookup for %s -> %s.\n", name, hp->h_name));
- fstrcpy(fqdn,hp->h_name);
- } else {
- DEBUG(10,("name_to_fqdn: lookup for %s failed.\n", name));
- fstrcpy(fqdn, name);
- }
-}
-
-/**********************************************************************
Adds a single service principal, i.e. 'host' to the system keytab
***********************************************************************/
-int ads_keytab_add_entry(const char *srvPrinc, ADS_STRUCT *ads)
+int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc)
{
krb5_error_code ret = 0;
krb5_context context = NULL;
@@ -254,8 +238,8 @@ int ads_keytab_add_entry(const char *srvPrinc, ADS_STRUCT *ads)
/* Update the LDAP with the SPN */
DEBUG(3,("ads_keytab_add_entry: Attempting to add/update '%s'\n", princ_s));
- if (!ADS_ERR_OK(ads_add_spn(ads, global_myname(), srvPrinc))) {
- DEBUG(1,("ads_keytab_add_entry: ads_add_spn failed.\n"));
+ if (!ADS_ERR_OK(ads_add_service_principal_name(ads, global_myname(), srvPrinc))) {
+ DEBUG(1,("ads_keytab_add_entry: ads_add_service_principcal_name failed.\n"));
goto out;
}
@@ -372,7 +356,7 @@ int ads_keytab_flush(ADS_STRUCT *ads)
ZERO_STRUCT(kt_entry);
cursor = NULL;
- if (!ADS_ERR_OK(ads_clear_spns(ads, global_myname()))) {
+ if (!ADS_ERR_OK(ads_clear_service_principal_names(ads, global_myname()))) {
DEBUG(1,("ads_keytab_flush: Error while clearing service principal listings in LDAP.\n"));
goto out;
}
@@ -413,12 +397,12 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
int i, found = 0;
char **oldEntries = NULL;
- ret = ads_keytab_add_entry("host", ads);
+ ret = ads_keytab_add_entry(ads, "host");
if (ret) {
DEBUG(1,("ads_keytab_create_default: ads_keytab_add_entry failed while adding 'host'.\n"));
return ret;
}
- ret = ads_keytab_add_entry("cifs", ads);
+ ret = ads_keytab_add_entry(ads, "cifs");
if (ret) {
DEBUG(1,("ads_keytab_create_default: ads_keytab_add_entry failed while adding 'cifs'.\n"));
return ret;
@@ -512,7 +496,7 @@ int ads_keytab_create_default(ADS_STRUCT *ads)
ZERO_STRUCT(kt_entry);
}
for (i = 0; oldEntries[i]; i++) {
- ret |= ads_keytab_add_entry(oldEntries[i], ads);
+ ret |= ads_keytab_add_entry(ads, oldEntries[i]);
krb5_free_unparsed_name(context, oldEntries[i]);
}
krb5_kt_end_seq_get(context, keytab, &cursor);