From 91750a2825e28765687953143e176c980065acaa Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Tue, 31 Jul 2007 23:43:59 +0000 Subject: r24108: Split out samba3_parse_domuser to a seperate file and rename, so it can be used for a name2domain call. (This used to be commit 75e41da039e10127820635500e185e24ea55c777) --- source4/winbind/wb_utils.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 source4/winbind/wb_utils.c (limited to 'source4/winbind/wb_utils.c') diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c new file mode 100644 index 0000000000..5938bb391d --- /dev/null +++ b/source4/winbind/wb_utils.c @@ -0,0 +1,47 @@ +/* + Unix SMB/CIFS implementation. + + Utility functions that are not related with async operations. + + Copyright (C) Andrew Bartlett 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" + + +/* Split a domain\\user string into it's parts, because the client supplies it + * as one string. + * TODO: We probably will need to handle other formats later. */ + +BOOL wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, + char **domain, char **user) +{ + char *p = strchr(domuser, *lp_winbind_separator()); + + if (p == NULL) { + *domain = talloc_strdup(mem_ctx, lp_workgroup()); + } else { + *domain = talloc_strndup(mem_ctx, domuser, + PTR_DIFF(p, domuser)); + domuser = p+1; + } + + *user = talloc_strdup(mem_ctx, domuser); + + return ((*domain != NULL) && (*user != NULL)); +} + + -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/winbind/wb_utils.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/winbind/wb_utils.c') diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c index 5938bb391d..b9d46af8c2 100644 --- a/source4/winbind/wb_utils.c +++ b/source4/winbind/wb_utils.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "param/param.h" /* Split a domain\\user string into it's parts, because the client supplies it -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/winbind/wb_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/winbind/wb_utils.c') diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c index b9d46af8c2..5fb14c1b4c 100644 --- a/source4/winbind/wb_utils.c +++ b/source4/winbind/wb_utils.c @@ -30,10 +30,10 @@ BOOL wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, char **domain, char **user) { - char *p = strchr(domuser, *lp_winbind_separator()); + char *p = strchr(domuser, *lp_winbind_separator(global_loadparm)); if (p == NULL) { - *domain = talloc_strdup(mem_ctx, lp_workgroup()); + *domain = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); } else { *domain = talloc_strndup(mem_ctx, domuser, PTR_DIFF(p, domuser)); -- cgit From efa384375f61049d7e7c43a77dc8abe0e034e04d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 1 Oct 2007 22:13:02 +0000 Subject: r25454: Use standard bool types in a couple more places. (This used to be commit 9243b551f30c7aa2763115516a6adcfe5bbddc58) --- source4/winbind/wb_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/winbind/wb_utils.c') diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c index 5fb14c1b4c..dfd09a98fe 100644 --- a/source4/winbind/wb_utils.c +++ b/source4/winbind/wb_utils.c @@ -27,7 +27,7 @@ * as one string. * TODO: We probably will need to handle other formats later. */ -BOOL wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, +bool wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, char **domain, char **user) { char *p = strchr(domuser, *lp_winbind_separator(global_loadparm)); -- cgit From 934e932387ea5668ec000bcefe4ec86935297339 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 21:32:08 +0100 Subject: r26235: Avoid global_loadparm. (This used to be commit e9039782204389cc827e76da319d5ccf6d33be46) --- source4/winbind/wb_utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/winbind/wb_utils.c') diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c index dfd09a98fe..43effc3028 100644 --- a/source4/winbind/wb_utils.c +++ b/source4/winbind/wb_utils.c @@ -27,13 +27,14 @@ * as one string. * TODO: We probably will need to handle other formats later. */ -bool wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, +bool wb_samba3_split_username(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, + const char *domuser, char **domain, char **user) { - char *p = strchr(domuser, *lp_winbind_separator(global_loadparm)); + char *p = strchr(domuser, *lp_winbind_separator(lp_ctx)); if (p == NULL) { - *domain = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); + *domain = talloc_strdup(mem_ctx, lp_workgroup(lp_ctx)); } else { *domain = talloc_strndup(mem_ctx, domuser, PTR_DIFF(p, domuser)); -- cgit