Skip to content

Commit

Permalink
nsswitch: Move nsswitch files from source4 to top level nsswitch dir
Browse files Browse the repository at this point in the history
  • Loading branch information
kblin committed Dec 16, 2008
1 parent 6821d89 commit 5ee0392
Show file tree
Hide file tree
Showing 24 changed files with 105 additions and 3,078 deletions.
3 changes: 1 addition & 2 deletions source4/nsswitch/config.m4 → nsswitch/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h )
case "$host_os" in
*linux*)
SMB_LIBRARY(nss_winbind,
[nsswitch/winbind_nss_linux.o],
[../nsswitch/winbind_nss_linux.o],
[LIBWINBIND-CLIENT])
;;
*)
;;
esac

2 changes: 1 addition & 1 deletion source4/nsswitch/config.mk → nsswitch/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ PRIVATE_DEPENDENCIES = \
#################################

wbinfo_OBJ_FILES = \
$(nsswitchsrcdir)/wbinfo.o
$(nsswitchsrcdir)/wbinfo4.o
46 changes: 23 additions & 23 deletions source4/nsswitch/nsstest.c → nsswitch/nsstest.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
nss tester for winbindd
Copyright (C) Andrew Tridgell 2001
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 <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -54,13 +54,13 @@ static void report_nss_error(const char *who, NSS_STATUS status)
{
last_error = status;
total_errors++;
printf("ERROR %s: NSS_STATUS=%d %d (nss_errno=%d)\n",
printf("ERROR %s: NSS_STATUS=%d %d (nss_errno=%d)\n",
who, status, NSS_STATUS_SUCCESS, nss_errno);
}

static struct passwd *nss_getpwent(void)
{
NSS_STATUS (*_nss_getpwent_r)(struct passwd *, char *,
NSS_STATUS (*_nss_getpwent_r)(struct passwd *, char *,
size_t , int *) = find_fn("getpwent_r");
static struct passwd pwd;
static char buf[1000];
Expand All @@ -79,12 +79,12 @@ static struct passwd *nss_getpwent(void)

static struct passwd *nss_getpwnam(const char *name)
{
NSS_STATUS (*_nss_getpwnam_r)(const char *, struct passwd *, char *,
NSS_STATUS (*_nss_getpwnam_r)(const char *, struct passwd *, char *,
size_t , int *) = find_fn("getpwnam_r");
static struct passwd pwd;
static char buf[1000];
NSS_STATUS status;

status = _nss_getpwnam_r(name, &pwd, buf, sizeof(buf), &nss_errno);
if (status == NSS_STATUS_NOTFOUND) {
return NULL;
Expand All @@ -98,12 +98,12 @@ static struct passwd *nss_getpwnam(const char *name)

static struct passwd *nss_getpwuid(uid_t uid)
{
NSS_STATUS (*_nss_getpwuid_r)(uid_t , struct passwd *, char *,
NSS_STATUS (*_nss_getpwuid_r)(uid_t , struct passwd *, char *,
size_t , int *) = find_fn("getpwuid_r");
static struct passwd pwd;
static char buf[1000];
NSS_STATUS status;

status = _nss_getpwuid_r(uid, &pwd, buf, sizeof(buf), &nss_errno);
if (status == NSS_STATUS_NOTFOUND) {
return NULL;
Expand Down Expand Up @@ -138,7 +138,7 @@ static void nss_endpwent(void)

static struct group *nss_getgrent(void)
{
NSS_STATUS (*_nss_getgrent_r)(struct group *, char *,
NSS_STATUS (*_nss_getgrent_r)(struct group *, char *,
size_t , int *) = find_fn("getgrent_r");
static struct group grp;
static char *buf;
Expand All @@ -147,7 +147,7 @@ static struct group *nss_getgrent(void)

if (!buf) buf = malloc_array_p(char, buflen);

again:
again:
status = _nss_getgrent_r(&grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
buflen *= 2;
Expand All @@ -166,15 +166,15 @@ static struct group *nss_getgrent(void)

static struct group *nss_getgrnam(const char *name)
{
NSS_STATUS (*_nss_getgrnam_r)(const char *, struct group *, char *,
NSS_STATUS (*_nss_getgrnam_r)(const char *, struct group *, char *,
size_t , int *) = find_fn("getgrnam_r");
static struct group grp;
static char *buf;
static int buflen = 1000;
NSS_STATUS status;

if (!buf) buf = malloc_array_p(char, buflen);
again:
again:
status = _nss_getgrnam_r(name, &grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
buflen *= 2;
Expand All @@ -193,15 +193,15 @@ static struct group *nss_getgrnam(const char *name)

static struct group *nss_getgrgid(gid_t gid)
{
NSS_STATUS (*_nss_getgrgid_r)(gid_t , struct group *, char *,
NSS_STATUS (*_nss_getgrgid_r)(gid_t , struct group *, char *,
size_t , int *) = find_fn("getgrgid_r");
static struct group grp;
static char *buf;
static int buflen = 1000;
NSS_STATUS status;

if (!buf) buf = malloc_array_p(char, buflen);
again:
again:
status = _nss_getgrgid_r(gid, &grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
buflen *= 2;
Expand Down Expand Up @@ -241,7 +241,7 @@ static void nss_endgrent(void)
static int nss_initgroups(char *user, gid_t group, gid_t **groups, long int *start, long int *size)
{
NSS_STATUS (*_nss_initgroups)(char *, gid_t , long int *,
long int *, gid_t **, long int , int *) =
long int *, gid_t **, long int , int *) =
find_fn("initgroups_dyn");
NSS_STATUS status;

Expand All @@ -256,7 +256,7 @@ static int nss_initgroups(char *user, gid_t group, gid_t **groups, long int *sta

static void print_passwd(struct passwd *pwd)
{
printf("%s:%s:%d:%d:%s:%s:%s\n",
printf("%s:%s:%d:%d:%s:%s:%s\n",
pwd->pw_name,
pwd->pw_passwd,
pwd->pw_uid,
Expand All @@ -269,16 +269,16 @@ static void print_passwd(struct passwd *pwd)
static void print_group(struct group *grp)
{
int i;
printf("%s:%s:%d: ",
printf("%s:%s:%d: ",
grp->gr_name,
grp->gr_passwd,
grp->gr_gid);

if (!grp->gr_mem[0]) {
printf("\n");
return;
}

for (i=0; grp->gr_mem[i+1]; i++) {
printf("%s, ", grp->gr_mem[i]);
}
Expand Down Expand Up @@ -397,7 +397,7 @@ static void nss_test_errors(void)
}

int main(int argc, char *argv[])
{
{
if (argc > 1) so_path = argv[1];
if (argc > 2) nss_name = argv[2];

Expand Down
10 changes: 5 additions & 5 deletions source4/nsswitch/nsstest.h → nsswitch/nsstest.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
Unix SMB/CIFS implementation.
nss includes for the nss tester
Copyright (C) Kai Blin 2007
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 <http://www.gnu.org/licenses/>.
*/
Expand All @@ -25,7 +25,7 @@

#ifdef HAVE_NSS_COMMON_H

/*
/*
* Sun Solaris
*/

Expand Down
3 changes: 1 addition & 2 deletions source4/nsswitch/nsstest.m4 → nsswitch/nsstest.m4
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
case "$host_os" in
*linux*)
*linux*)
SMB_ENABLE(nsstest,YES)
;;
*)
SMB_ENABLE(nsstest,NO)
;;
esac

Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,3 @@ testit "wbinfo -K against $TARGET with domain creds" $wbinfo -K "$DOMAIN/$USERNA
testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=`expr $failed + 1`

exit $failed

Loading

0 comments on commit 5ee0392

Please sign in to comment.