summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-03-21 21:22:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:08 -0500
commit05bc2d7b2c11a3583a6d1221cfbd618eb6730518 (patch)
treef0c2966e0a67c381ae1a94cd5c33c59ea8d33f14 /source4/libcli
parent34cde065139fdc76f6aa529426cfc1f68a394d54 (diff)
downloadsamba-05bc2d7b2c11a3583a6d1221cfbd618eb6730518.tar.gz
samba-05bc2d7b2c11a3583a6d1221cfbd618eb6730518.tar.bz2
samba-05bc2d7b2c11a3583a6d1221cfbd618eb6730518.zip
r5928: Use cli_credentials in:
- gtk+ (returned by GtkHostBindingDialog as well now) - torture/ - librpc/ - lib/com/dcom/ (This used to be commit ccefd782335e01e8e6ecb2bcd28a4f999c53b1a6)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/auth/gensec.c63
1 files changed, 4 insertions, 59 deletions
diff --git a/source4/libcli/auth/gensec.c b/source4/libcli/auth/gensec.c
index d3fa7daae3..69de016156 100644
--- a/source4/libcli/auth/gensec.c
+++ b/source4/libcli/auth/gensec.c
@@ -511,65 +511,10 @@ BOOL gensec_have_feature(struct gensec_security *gensec_security,
*
*/
-NTSTATUS gensec_set_unparsed_username(struct gensec_security *gensec_security, const char *user)
-{
- char *p;
- char *u = talloc_strdup(gensec_security, user);
- if (!u) {
- return NT_STATUS_NO_MEMORY;
- }
-
- p = strchr_m(user, '@');
-
- if (p) {
- *p = '\0';
- gensec_security->user.name = talloc_strdup(gensec_security, u);
- if (!gensec_security->user.name) {
- return NT_STATUS_NO_MEMORY;
- }
-
- gensec_security->user.realm = talloc_strdup(gensec_security, p+1);
- if (!gensec_security->user.realm) {
- return NT_STATUS_NO_MEMORY;
- }
- return NT_STATUS_OK;
- }
-
- p = strchr_m(user, '\\');
- if (!p) {
- p = strchr_m(user, '/');
- }
-
- if (p) {
- *p = '\0';
- gensec_security->user.domain = talloc_strdup(gensec_security, u);
- if (!gensec_security->user.domain) {
- return NT_STATUS_NO_MEMORY;
- }
- gensec_security->user.name = talloc_strdup(gensec_security, p+1);
- if (!gensec_security->user.name) {
- return NT_STATUS_NO_MEMORY;
- }
-
- return NT_STATUS_OK;
- }
-
- gensec_security->user.name = u;
- if (!gensec_security->user.name) {
- return NT_STATUS_NO_MEMORY;
- }
- return NT_STATUS_OK;
-}
-
-/**
- * Set a username on a GENSEC context - ensures it is talloc()ed
- *
- */
-
NTSTATUS gensec_set_username(struct gensec_security *gensec_security, const char *user)
{
gensec_security->user.name = talloc_strdup(gensec_security, user);
- if (!gensec_security->user.name) {
+ if (user && !gensec_security->user.name) {
return NT_STATUS_NO_MEMORY;
}
return NT_STATUS_OK;
@@ -596,7 +541,7 @@ const char *gensec_get_username(struct gensec_security *gensec_security)
NTSTATUS gensec_set_domain(struct gensec_security *gensec_security, const char *domain)
{
gensec_security->user.domain = talloc_strdup(gensec_security, domain);
- if (!gensec_security->user.domain) {
+ if (domain && !gensec_security->user.domain) {
return NT_STATUS_NO_MEMORY;
}
return NT_STATUS_OK;
@@ -625,7 +570,7 @@ const char *gensec_get_domain(struct gensec_security *gensec_security)
NTSTATUS gensec_set_workstation(struct gensec_security *gensec_security, const char *workstation)
{
gensec_security->user.workstation = talloc_strdup(gensec_security, workstation);
- if (!gensec_security->user.workstation) {
+ if (workstation && !gensec_security->user.workstation) {
return NT_STATUS_NO_MEMORY;
}
return NT_STATUS_OK;
@@ -653,7 +598,7 @@ const char *gensec_get_workstation(struct gensec_security *gensec_security)
NTSTATUS gensec_set_realm(struct gensec_security *gensec_security, const char *realm)
{
gensec_security->user.realm = talloc_strdup(gensec_security, realm);
- if (!gensec_security->user.realm) {
+ if (realm && !gensec_security->user.realm) {
return NT_STATUS_NO_MEMORY;
}
return NT_STATUS_OK;