diff options
author | Simo Sorce <idra@samba.org> | 2008-07-06 12:03:35 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-07-06 12:03:35 -0400 |
commit | d0a71a00bb0408713eca523807955b6dd087f2bc (patch) | |
tree | eed94ce0a4b0898bb7d2cde27417e347e55fb1f2 | |
parent | 4dbfa7a211317be2e46657a3bdc040091049a75d (diff) | |
download | samba-d0a71a00bb0408713eca523807955b6dd087f2bc.tar.gz samba-d0a71a00bb0408713eca523807955b6dd087f2bc.tar.bz2 samba-d0a71a00bb0408713eca523807955b6dd087f2bc.zip |
Make code more readable, fix indentation and traling spaces.
(This used to be commit e19e12d5cbba28ccf682eaf0ff26909bd7e8e6c6)
-rw-r--r-- | source3/winbindd/winbindd_user.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/source3/winbindd/winbindd_user.c b/source3/winbindd/winbindd_user.c index 45918383b7..270a297b7c 100644 --- a/source3/winbindd/winbindd_user.c +++ b/source3/winbindd/winbindd_user.c @@ -365,23 +365,27 @@ void winbindd_getpwnam(struct winbindd_cli_state *state) { struct winbindd_domain *domain; fstring domname, username; + char *domuser; + size_t dusize; - /* Ensure null termination */ - state->request.data.username[sizeof(state->request.data.username)-1]='\0'; + domuser = state->request.data.username; + dusize = sizeof(state->request.data.username); - DEBUG(3, ("[%5lu]: getpwnam %s\n", (unsigned long)state->pid, - state->request.data.username)); + /* Ensure null termination (it's an fstring) */ + domuser[dusize-1] = '\0'; - ws_name_return( state->request.data.username, WB_REPLACE_CHAR ); + DEBUG(3, ("[%5lu]: getpwnam %s\n", + (unsigned long)state->pid, + domuser)); - if (!parse_domain_user(state->request.data.username, domname, - username)) { - DEBUG(5, ("Could not parse domain user: %s\n", - state->request.data.username)); + ws_name_return(domuser, WB_REPLACE_CHAR); + + if (!parse_domain_user(domuser, domname, username)) { + DEBUG(5, ("Could not parse domain user: %s\n", domuser)); request_error(state); return; } - + /* Get info for the domain */ domain = find_domain_from_name(domname); @@ -391,17 +395,19 @@ void winbindd_getpwnam(struct winbindd_cli_state *state) "Using primary domain\n", domname)); if ( (domain = find_our_domain()) == NULL ) { DEBUG(0,("Cannot find my primary domain structure!\n")); - request_error(state); - return; - } + request_error(state); + return; + } } - if ( strequal(domname, lp_workgroup()) && lp_winbind_trusted_domains_only() ) { - DEBUG(7,("winbindd_getpwnam: My domain -- rejecting getpwnam() for %s\\%s.\n", - domname, username)); + if (strequal(domname, lp_workgroup()) && + lp_winbind_trusted_domains_only() ) { + DEBUG(7,("winbindd_getpwnam: My domain -- " + "rejecting getpwnam() for %s\\%s.\n", + domname, username)); request_error(state); return; - } + } /* Get rid and name type from name. The following costs 1 packet */ |