diff options
| author | Dave Olson <olson@cumulusnetworks.com> | 2018-04-02 10:50:18 -0700 | 
|---|---|---|
| committer | Dave Olson <olson@cumulusnetworks.com> | 2018-04-10 12:33:12 -0700 | 
| commit | 7f2e226bde6e6cd5cc7b29f7385a8c14a9b8b66f (patch) | |
| tree | f163585c36bfd16852c0caec21fdb4b42cfde968 /nss_mapname.c | |
| parent | a8740bec7979f1060ab6759808e9f02dce184e46 (diff) | |
| download | libnss-mapuser-7f2e226bde6e6cd5cc7b29f7385a8c14a9b8b66f.tar.gz libnss-mapuser-7f2e226bde6e6cd5cc7b29f7385a8c14a9b8b66f.zip  | |
Cleanup whitespace by running 'indent -linux' on all the files
There were no code changes, just the indent whitespace and formatting
changes.
Diffstat (limited to 'nss_mapname.c')
| -rw-r--r-- | nss_mapname.c | 130 | 
1 files changed, 64 insertions, 66 deletions
diff --git a/nss_mapname.c b/nss_mapname.c index f795cf5..e974b75 100644 --- a/nss_mapname.c +++ b/nss_mapname.c @@ -35,12 +35,10 @@   * See nss_mapuid.c for the matching getpwuid_r for UIDs.   */ -  #include "map_common.h"  #include <stdbool.h> - -static const char *nssname = "nss_mapuser"; /* for syslogs */ +static const char *nssname = "nss_mapuser";	/* for syslogs */  /*   * If you aren't using glibc or a variant that supports this, @@ -57,75 +55,75 @@ extern const char *__progname;   * Because we always have a positive reply, it's important that this   * be the last NSS module for passwd lookups.   */ -__attribute__ ((visibility ("default"))) +__attribute__ ((visibility("default")))  enum nss_status _nss_mapname_getpwnam_r(const char *name, struct passwd *pw, -    char *buffer, size_t buflen, int *errnop) +					char *buffer, size_t buflen, +					int *errnop)  { -    enum nss_status status = NSS_STATUS_NOTFOUND; -    struct pwbuf pbuf; -    bool islocal = 0; - -    /* -     * the useradd family will not add/mod/del users correctly with -     * the mapuid functionality, so return immediately if we are -     * running as part of those processes. -     */ -    if (__progname && (!strcmp(__progname, "useradd") ||  -        !strcmp(__progname, "usermod") ||  -        !strcmp(__progname, "userdel"))) -        return status; +	enum nss_status status = NSS_STATUS_NOTFOUND; +	struct pwbuf pbuf; +	bool islocal = 0; -    if (nss_mapuser_config(errnop, nssname) == 1) { -         syslog(LOG_NOTICE, "%s: bad configuration", nssname); -         return status; -    } +	/* +	 * the useradd family will not add/mod/del users correctly with +	 * the mapuid functionality, so return immediately if we are +	 * running as part of those processes. +	 */ +	if (__progname && (!strcmp(__progname, "useradd") || +			   !strcmp(__progname, "usermod") || +			   !strcmp(__progname, "userdel"))) +		return status; -    /* -     * Ignore any name starting with tacacs[0-9] in case a -     * tacplus client is installed.  Cleaner than listing -     * all 16 in the exclude_users list or implementing -     * some form of wildcard.  Also ignore our own mappeduser -     * and mapped_priv_user names if set. -     */ -    if ((mappeduser && !strcmp(mappeduser, name)) || -        (mapped_priv_user && !strcmp(mapped_priv_user, name))) -        islocal = 1; -    else if (!strncmp("tacacs", name, 6) && isdigit(name[6])) -        islocal = 1; -    else if (exclude_users) { -        char *user, *list; -        list = strdup(exclude_users); -        if (list) { -            static const char *delim = ", \t\n"; -            user = strtok(list, delim); -            list = NULL; -            while (user) { -                if(!strcmp(user, name)) { -                    islocal = 1; -                    break; -                } -                user = strtok(NULL, delim); -            } -            free(list); -        } -    } -    if (islocal) { -        if(debug > 1) -            syslog(LOG_DEBUG, "%s: skipped excluded user: %s", nssname, -                name); -        return 2; -    } +	if (nss_mapuser_config(errnop, nssname) == 1) { +		syslog(LOG_NOTICE, "%s: bad configuration", nssname); +		return status; +	} +	/* +	 * Ignore any name starting with tacacs[0-9] in case a +	 * tacplus client is installed.  Cleaner than listing +	 * all 16 in the exclude_users list or implementing +	 * some form of wildcard.  Also ignore our own mappeduser +	 * and mapped_priv_user names if set. +	 */ +	if ((mappeduser && !strcmp(mappeduser, name)) || +	    (mapped_priv_user && !strcmp(mapped_priv_user, name))) +		islocal = 1; +	else if (!strncmp("tacacs", name, 6) && isdigit(name[6])) +		islocal = 1; +	else if (exclude_users) { +		char *user, *list; +		list = strdup(exclude_users); +		if (list) { +			static const char *delim = ", \t\n"; +			user = strtok(list, delim); +			list = NULL; +			while (user) { +				if (!strcmp(user, name)) { +					islocal = 1; +					break; +				} +				user = strtok(NULL, delim); +			} +			free(list); +		} +	} +	if (islocal) { +		if (debug > 1) +			syslog(LOG_DEBUG, "%s: skipped excluded user: %s", +			       nssname, name); +		return 2; +	} -    /* marshal the args for the lower level functions */ -    pbuf.name = (char *)name; -    pbuf.pw = pw; -    pbuf.buf = buffer; -    pbuf.buflen = buflen; -    pbuf.errnop = errnop; +	/* marshal the args for the lower level functions */ +	pbuf.name = (char *)name; +	pbuf.pw = pw; +	pbuf.buf = buffer; +	pbuf.buflen = buflen; +	pbuf.errnop = errnop; -    if(!get_pw_mapuser(name, &pbuf)) -        status = NSS_STATUS_SUCCESS; +	if (!get_pw_mapuser(name, &pbuf)) +		status = NSS_STATUS_SUCCESS; -    return status; +	return status;  }  | 
