summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2007-09-28 03:54:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:02 -0500
commit3529156971e17c7ec13f6a6243f7b613e4666cdd (patch)
tree0f6479de4c560c92a75826d955020659a36ef060 /source3/libads
parent470ebf8a3504474dea5c324d01282e59c034a236 (diff)
downloadsamba-3529156971e17c7ec13f6a6243f7b613e4666cdd.tar.gz
samba-3529156971e17c7ec13f6a6243f7b613e4666cdd.tar.bz2
samba-3529156971e17c7ec13f6a6243f7b613e4666cdd.zip
r25400: Windows 2008 (Longhorn) Interop fixes for AD specific auth2 flags,
and client fixes. Patch from Todd Stetcher <todd.stetcher@isilon.com>. (This used to be commit 8304ccba7346597425307e260e88647e49081f68)
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/sasl.c4
-rw-r--r--source3/libads/util.c54
2 files changed, 24 insertions, 34 deletions
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index dec8756a86..590052ec85 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -747,6 +747,7 @@ static ADS_STATUS ads_sasl_spnego_bind(ADS_STRUCT *ads)
char *OIDs[ASN1_MAX_OIDS];
#ifdef HAVE_KRB5
BOOL got_kerberos_mechanism = False;
+ BOOL try_kerberos = True;
#endif
rc = ldap_sasl_bind_s(ads->ldap.ld, NULL, "GSS-SPNEGO", NULL, NULL, NULL, &scred);
@@ -784,7 +785,8 @@ static ADS_STATUS ads_sasl_spnego_bind(ADS_STRUCT *ads)
#endif
free(OIDs[i]);
}
- DEBUG(3,("ads_sasl_spnego_bind: got server principal name = %s\n", given_principal));
+ DEBUG(3,("ads_sasl_spnego_bind: got server principal name = %s\n",
+ (given_principal ? given_principal : NULL)));
#ifdef HAVE_KRB5
if (!(ads->auth.flags & ADS_AUTH_DISABLE_KERBEROS) &&
diff --git a/source3/libads/util.c b/source3/libads/util.c
index af96c3e10a..472fe4a214 100644
--- a/source3/libads/util.c
+++ b/source3/libads/util.c
@@ -55,57 +55,45 @@ failed:
ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
char **returned_principal)
{
+ ADS_STATUS status;
char *princ = NULL;
+ char *server = NULL;
+ char *server_realm = NULL;
if (ads->server.realm && ads->server.ldap_server) {
- char *server, *server_realm;
-
server = SMB_STRDUP(ads->server.ldap_server);
server_realm = SMB_STRDUP(ads->server.realm);
- if (!server || !server_realm) {
- return ADS_ERROR(LDAP_NO_MEMORY);
- }
-
- strlower_m(server);
- strupper_m(server_realm);
- asprintf(&princ, "ldap/%s@%s", server, server_realm);
-
- SAFE_FREE(server);
- SAFE_FREE(server_realm);
-
- if (!princ) {
- return ADS_ERROR(LDAP_NO_MEMORY);
+ if (!server || !server_realm) {
+ status = ADS_ERROR(LDAP_NO_MEMORY);
+ goto fail;
}
} else if (ads->config.realm && ads->config.ldap_server_name) {
- char *server, *server_realm;
-
server = SMB_STRDUP(ads->config.ldap_server_name);
server_realm = SMB_STRDUP(ads->config.realm);
- if (!server || !server_realm) {
- return ADS_ERROR(LDAP_NO_MEMORY);
- }
-
- strlower_m(server);
- strupper_m(server_realm);
- asprintf(&princ, "ldap/%s@%s", server, server_realm);
-
- SAFE_FREE(server);
- SAFE_FREE(server_realm);
-
- if (!princ) {
- return ADS_ERROR(LDAP_NO_MEMORY);
- }
+ if (!server || !server_realm) {
+ status = ADS_ERROR(LDAP_NO_MEMORY);
+ goto fail;
+ }
}
+ strlower_m(server);
+ strupper_m(server_realm);
+ asprintf(&princ, "ldap/%s@%s", server, server_realm);
+
if (!princ) {
- return ADS_ERROR(LDAP_PARAM_ERROR);
+ status = ADS_ERROR(LDAP_PARAM_ERROR);
}
*returned_principal = princ;
+ status = ADS_SUCCESS;
+
+fail:
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
- return ADS_SUCCESS;
+ return status;
}
#endif