1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

merge some of the nsswitch code from tng to head

the libnss_winbind.so from head now works with
the winbindd from tng
This commit is contained in:
Andrew Tridgell -
parent b9137b613d
commit 67ccfd2826
5 changed files with 701 additions and 268 deletions

View File

@ -384,9 +384,9 @@ WINBINDD_OBJ = \
$(LIBNMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
$(NSSWINS_OBJ) $(SIDDB_OBJ) $(LIBSMB_OBJ)
WBINFO_OBJ = nsswitch/wbinfo.o nsswitch/wb_common.o
WBINFO_OBJ = nsswitch/wbinfo.o
WINBIND_NSS_OBJ = nsswitch/winbind.o nsswitch/wb_common.o
WINBIND_NSS_OBJ = nsswitch/winbind_nss.o nsswitch/wb_common.o
WINBIND_NSS_PICOBJS = $(WINBIND_NSS_OBJ:.o=.po)

View File

@ -37,7 +37,7 @@ void init_request(struct winbindd_request *request, int request_type)
static char *domain_env;
static BOOL initialised;
request->cmd = (enum winbindd_cmd)request_type;
request->cmd = request_type;
request->pid = getpid();
request->domain[0] = '\0';
@ -59,7 +59,7 @@ void init_response(struct winbindd_response *response)
{
/* Initialise return value */
response->result = (enum winbindd_result)NSS_STATUS_UNAVAIL;
response->result = WINBINDD_ERROR;
}
/* Close established socket */
@ -141,6 +141,7 @@ static int open_pipe_sock(void)
if (connect(established_socket, (struct sockaddr *)&sunaddr,
sizeof(sunaddr)) == -1) {
close_sock();
established_socket = -1;
return -1;
}
@ -304,7 +305,7 @@ void free_response(struct winbindd_response *response)
/* Handle simple types of requests */
enum nss_status winbindd_request(int req_type,
NSS_STATUS winbindd_request(int req_type,
struct winbindd_request *request,
struct winbindd_response *response)
{

View File

@ -101,10 +101,11 @@ static BOOL wbinfo_check_secret(void)
if (result) {
if (response.data.num_entries) {
if (response.data.num_entries == 0) {
printf("Secret is good\n");
} else {
printf("Secret is bad\n");
printf("Secret is bad\n0x%08x\n",
response.data.num_entries);
}
return True;
@ -447,8 +448,8 @@ int main(int argc, char **argv)
return 1;
}
break;
/* Invalid option */
/* Invalid option */
default:
usage();

File diff suppressed because it is too large Load Diff

View File

@ -70,17 +70,62 @@
#include <errno.h>
#include <pwd.h>
#ifdef HAVE_NSS_H
#ifdef HAVE_NSS_COMMON_H
/* Sun Solaris */
#include <nss_common.h>
#include <nss_dbdefs.h>
#include <nsswitch.h>
typedef nss_status_t NSS_STATUS;
#define NSS_STATUS_SUCCESS NSS_SUCCESS
#define NSS_STATUS_NOTFOUND NSS_NOTFOUND
#define NSS_STATUS_UNAVAIL NSS_UNAVAIL
#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
#elif HAVE_NSS_H
/* GNU */
#include <nss.h>
#else
/* Minimal needed to compile.. */
enum nss_status {
NSS_STATUS_SUCCESS,
NSS_STATUS_NOTFOUND,
NSS_STATUS_UNAVAIL
};
typedef enum nss_status NSS_STATUS;
#else /* Nothing's defined. Neither gnu nor sun */
typedef enum
{
NSS_STATUS_SUCCESS,
NSS_STATUS_NOTFOUND,
NSS_STATUS_UNAVAIL,
NSS_STATUS_TRYAGAIN
} NSS_STATUS;
#endif
/* Declarations for functions in winbind_nss.c
needed in winbind_nss_solaris.c (solaris wrapper to nss) */
NSS_STATUS _nss_winbind_setpwent(void);
NSS_STATUS _nss_winbind_endpwent(void);
NSS_STATUS _nss_winbind_getpwent_r(struct passwd* result, char* buffer,
size_t buflen, int* errnop);
NSS_STATUS _nss_winbind_getpwuid_r(uid_t, struct passwd*, char* buffer,
size_t buflen, int* errnop);
NSS_STATUS _nss_winbind_getpwnam_r(const char* name, struct passwd* result,
char* buffer, size_t buflen, int* errnop);
NSS_STATUS _nss_winbind_setgrent(void);
NSS_STATUS _nss_winbind_endgrent(void);
NSS_STATUS _nss_winbind_getgrent_r(struct group* result, char* buffer,
size_t buflen, int* errnop);
NSS_STATUS _nss_winbind_getgrnam_r(const char *name,
struct group *result, char *buffer,
size_t buflen, int *errnop);
NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid,
struct group *result, char *buffer,
size_t buflen, int *errnop);
/* I'm trying really hard not to include anything from smb.h with the
result of some silly looking redeclaration of structures. */
@ -127,6 +172,7 @@ typedef int BOOL;
/* zero a structure given a pointer to the structure */
#define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
/* Some systems (SCO) treat UNIX domain sockets as FIFOs */
#ifndef S_IFSOCK