diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-01-20 01:24:59 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-01-20 01:24:59 +0000 |
commit | 93a8358910d2b8788ffea33c04244ffd5ffecabf (patch) | |
tree | b087c75b8cdf4818a8355e678b1e212cc3f9052d /source3/nsswitch/winbindd_util.c | |
parent | a6541401b03e0a97dc7e265b223289cad7160b75 (diff) | |
download | samba-93a8358910d2b8788ffea33c04244ffd5ffecabf.tar.gz samba-93a8358910d2b8788ffea33c04244ffd5ffecabf.tar.bz2 samba-93a8358910d2b8788ffea33c04244ffd5ffecabf.zip |
This patch makes the 'winbind use default domain' code interact better with
smbd, and also makes it much cleaner inside winbindd.
It is mostly my code, with a few changes and testing performed by Alexander
Bokovoy <a.bokovoy@sam-solutions.net>. ab has tested it in security=domain and
security=ads, but more testing is always appricatiated.
The idea is that we no longer cart around a 'domain\user' string, we keep them
seperate until the last moment - when we push that string into a pwent on onto
the socket.
This removes the need to be constantly parsing that string - the domain prefix
is almost always already provided, (only a couple of functions actually changed
arguments in all this).
Some consequential changes to the RPC client code, to stop it concatonating the
two strings (it now passes them both back as params).
I havn't changed the cache code, however the usernames will no longer have a
double domain prefix in the key string. The actual structures are unchanged
- but the meaning of 'username' in the 'rid' will have changed. (The cache is
invalidated at startup, so on-disk formats are not an issue here).
Andrew Bartlett
(This used to be commit e870f0e727952aeb8599cf93ad2650ae56eca033)
Diffstat (limited to 'source3/nsswitch/winbindd_util.c')
-rw-r--r-- | source3/nsswitch/winbindd_util.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index 640b581ce3..ad362ff8a6 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -216,6 +216,7 @@ struct winbindd_domain *find_domain_from_sid(DOM_SID *sid) /* Lookup a sid in a domain from a name */ BOOL winbindd_lookup_sid_by_name(struct winbindd_domain *domain, + const char *dom_name, const char *name, DOM_SID *sid, enum SID_NAME_USE *type) { @@ -244,6 +245,8 @@ BOOL winbindd_lookup_sid_by_name(struct winbindd_domain *domain, * * @param name On success, set to the name corresponding to @p sid. * + * @param dom_name On success, set to the 'domain name' corresponding to @p sid. + * * @param type On success, contains the type of name: alias, group or * user. * @@ -251,6 +254,7 @@ BOOL winbindd_lookup_sid_by_name(struct winbindd_domain *domain, * are set, otherwise False. **/ BOOL winbindd_lookup_name_by_sid(DOM_SID *sid, + fstring dom_name, fstring name, enum SID_NAME_USE *type) { @@ -277,6 +281,7 @@ BOOL winbindd_lookup_name_by_sid(DOM_SID *sid, /* Return name and type if successful */ if ((rv = NT_STATUS_IS_OK(result))) { + fstrcpy(dom_name, domain->name); fstrcpy(name, names); } else { *type = SID_NAME_UNKNOWN; @@ -369,28 +374,6 @@ BOOL parse_domain_user(const char *domuser, fstring domain, fstring user) return True; } -/* - Strip domain name if it is same as default domain name and - winbind use default domain = true - - it assumes that name is actually fstring so that memory management - isn't needed. -*/ -void strip_domain_name_if_needed(fstring *name) -{ - if(lp_winbind_use_default_domain()) { - char *sep = lp_winbind_separator(); - char *new_name = strchr(*name, *sep); - if(new_name) { - *new_name = 0; - if (!strcmp(global_myworkgroup, *name)) { - new_name++; - safe_strcpy(*name, new_name, sizeof(fstring)); - } else *new_name = *sep; - } - } -} - /* Fill DOMAIN\\USERNAME entry accounting 'winbind use default domain' and 'winbind separator' options. |