]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup of winbind header dependencies to correct building with
authorhno <>
Tue, 11 Feb 2003 21:34:30 +0000 (21:34 +0000)
committerhno <>
Tue, 11 Feb 2003 21:34:30 +0000 (21:34 +0000)
current Samba releases and make migration easier in future (and also
backward to older Samba versions if needed)

1. Centralize the headers to include/samba/nsswitch

2. Upgraded the headers to Samba-2.2.7a, without any changes

3. Added a --with-samba-source=... configure option to manually specify
   other headers to use (top level Samba source directory)

21 files changed:
Makefile.am
configure.in
helpers/basic_auth/winbind/Makefile.am
helpers/basic_auth/winbind/wb_basic_auth.c
helpers/basic_auth/winbind/wb_common.c
helpers/basic_auth/winbind/winbind_nss_config.h [deleted file]
helpers/basic_auth/winbind/winbindd_nss.h [deleted file]
helpers/external_acl/winbind_group/Makefile.am
helpers/external_acl/winbind_group/samba_nss.h [deleted file]
helpers/external_acl/winbind_group/wb_check_group.c
helpers/external_acl/winbind_group/wb_common.c
helpers/external_acl/winbind_group/winbind_nss_config.h [deleted file]
helpers/ntlm_auth/winbind/Makefile.am
helpers/ntlm_auth/winbind/samba_nss.h [deleted file]
helpers/ntlm_auth/winbind/wb_common.c
helpers/ntlm_auth/winbind/wb_ntlm_auth.c
helpers/ntlm_auth/winbind/winbindd_nss.h [deleted file]
include/samba/README.txt [new file with mode: 0644]
include/samba/nsswitch/sys_nss.h [moved from helpers/basic_auth/winbind/samba_nss.h with 93% similarity]
include/samba/nsswitch/winbind_nss_config.h [moved from helpers/ntlm_auth/winbind/winbind_nss_config.h with 94% similarity]
include/samba/nsswitch/winbindd_nss.h [moved from helpers/external_acl/winbind_group/winbindd_nss.h with 96% similarity, mode: 0644]

index 80a9c0fb6d5992bcbbdbfbf57b627b0f48d654a1..bb548ffce2dd6ab93d905d4851d5884c35de9892 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-# $Id: Makefile.am,v 1.18 2003/01/23 00:34:50 robertc Exp $
+# $Id: Makefile.am,v 1.19 2003/02/11 14:34:30 hno Exp $
 #
 
 AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5
@@ -11,7 +11,7 @@ DISTCLEANFILES = include/stamp-h include/stamp-h[0-9]*
 DEFAULT_PINGER         = $(libexecdir)/pinger$(EXEEXT)
 
 dist-hook:
-       @ for subdir in "include"; do \
+       @ for subdir in "include include/samba/nsswitch"; do \
          if test "$$subdir" = .; then :; else \
            test -d $(distdir)/$$subdir \
            || mkdir $(distdir)/$$subdir \
index e02dc797a947f296654c1a88022a9a78c319f88d..6802376c336723d494f4860b47ac107baaef27bc 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.320 2003/02/08 17:06:58 hno Exp $
+dnl  $Id: configure.in,v 1.321 2003/02/11 14:34:31 hno Exp $
 dnl
 dnl
 dnl
@@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 3.0-DEVEL)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.320 $)dnl
+AC_REVISION($Revision: 1.321 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -1189,6 +1189,24 @@ AC_ARG_ENABLE(mempools,
   fi
 ])
 
+
+SAMBASOURCES='$(top_srcdir)/include/samba'
+AC_ARG_WITH(samba-sources,
+[  --with-samba-sources=/path/to/samba-source-tree
+                          Path where the correct Samba source files can be
+                         found while building winbind helpers. (defaults to
+                         use internal copies of the headers from Samba-2.2.7)
+                         ],
+[ if test -f $withval/source/nsswitch/winbind_nss_config.h; then
+       echo "Using Samba sources from $withval"
+       SAMBASOURCES="$withval/source"
+    else
+       echo "ERROR: Cannot find Samba sources at $withval"
+       exit 1
+    fi
+])
+AC_SUBST(SAMBASOURCES)
+
 dnl Disable "unlinkd" code
 AC_ARG_ENABLE(unlinkd,
 [  --disable-unlinkd       Do not use unlinkd],
index 128f2aaef16941ded8bd116dd1796db34337d54e..6dcc4d371dcf2c58700f4f1dd92dccddb3d12867 100644 (file)
@@ -1,10 +1,10 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.6 2003/01/23 00:35:52 robertc Exp $
+#  $Id: Makefile.am,v 1.7 2003/02/11 14:34:31 hno Exp $
 #
 
 libexec_PROGRAMS = wb_auth
-wb_auth_SOURCES = wb_basic_auth.c wb_common.c samba_nss.h winbindd_nss.h wbntlm.h winbind_nss_config.h
-INCLUDES = -I$(top_srcdir)/include
+wb_auth_SOURCES = wb_basic_auth.c wb_common.c wbntlm.h
+INCLUDES = -I$(top_srcdir)/include -I@SAMBASOURCES@
 LDADD = -L$(top_builddir)/lib -lmiscutil -lntlmauth $(XTRA_LIBS)
index 9e959dc2cb8cb26d331d038e580be69c0a134339..326a31c0499a7829d20ad5b911e1ad594efc1796 100644 (file)
@@ -25,8 +25,8 @@
 #include <sys/time.h>           /* for gettimeofday */
 #include <errno.h>              /* BUG: is this portable? */
 
-#include "winbind_nss_config.h"
-#include "winbindd_nss.h"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbindd_nss.h"
 
 char debug_enabled=0;
 char *myname;
index 1049529452eb9ffb1ee3e852dbf08eb0abe2ff3a..785ef86ffe1f493f3c41dd68e09f2480f25a734f 100644 (file)
@@ -23,8 +23,8 @@
    Boston, MA  02111-1307, USA.   
 */
 
-#include "winbind_nss_config.h"
-#include "winbindd_nss.h"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbindd_nss.h"
 #include "config.h"
 
 
diff --git a/helpers/basic_auth/winbind/winbind_nss_config.h b/helpers/basic_auth/winbind/winbind_nss_config.h
deleted file mode 100644 (file)
index ac80f4a..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
-
-   Winbind daemon for ntdom nss module
-
-   Copyright (C) Tim Potter 2000
-   
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
-   This library 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
-   Library General Public License for more details.
-   
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the
-   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA  02111-1307, USA.   
-*/
-
-#ifndef _WINBIND_NSS_CONFIG_H
-#define _WINBIND_NSS_CONFIG_H
-
-/* Include header files from data in config.h file */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_UNIXSOCKET
-#include <sys/un.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <pwd.h>
-#include "samba_nss.h"
-
-/* 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. */
-
-#ifndef _PSTRING
-#define _PSTRING
-#define PSTRING_LEN 1024
-#define FSTRING_LEN 256
-typedef char pstring[PSTRING_LEN];
-typedef char fstring[FSTRING_LEN];
-#endif
-
-#ifndef _BOOL
-#define _BOOL                  /* So we don't typedef BOOL again in vfs.h */
-#define False (0)
-#define True (1)
-#define Auto (2)
-typedef int BOOL;
-#endif
-
-#if !defined(uint32)
-#if (SIZEOF_INT == 4)
-#define uint32 unsigned int
-#elif (SIZEOF_LONG == 4)
-#define uint32 unsigned long
-#elif (SIZEOF_SHORT == 4)
-#define uint32 unsigned short
-#endif
-#endif
-
-#if !defined(uint16)
-#if (SIZEOF_SHORT == 4)
-#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
-#else /* SIZEOF_SHORT != 4 */
-#define uint16 unsigned short
-#endif /* SIZEOF_SHORT != 4 */
-#endif
-
-#ifndef uint8
-#define uint8 unsigned char
-#endif
-
-/* zero a structure */
-#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
-
-/* 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
-#define S_IFSOCK S_IFIFO
-#endif
-
-#ifndef S_ISSOCK
-#define S_ISSOCK(mode)  ((mode & S_IFSOCK) == S_IFSOCK)
-#endif
-
-#endif
diff --git a/helpers/basic_auth/winbind/winbindd_nss.h b/helpers/basic_auth/winbind/winbindd_nss.h
deleted file mode 100644 (file)
index a88b120..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
-
-   Winbind daemon for ntdom nss module
-
-   Copyright (C) Tim Potter 2000
-   
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
-   This library 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
-   Library General Public License for more details.
-   
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the
-   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA  02111-1307, USA.   
-*/
-
-#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
-#endif
-
-#ifndef _WINBINDD_NTDOM_H
-#define _WINBINDD_NTDOM_H
-
-#define WINBINDD_SOCKET_NAME "pipe"            /* Name of PF_UNIX socket */
-#define WINBINDD_SOCKET_DIR  "/tmp/.winbindd"  /* Name of PF_UNIX dir */
-
-#define WINBINDD_DOMAIN_ENV  "WINBINDD_DOMAIN" /* Environment variables */
-#define WINBINDD_DONT_ENV    "_NO_WINBINDD"
-
-/* Update this when you change the interface.  */
-
-#define WINBIND_INTERFACE_VERSION 2
-
-/* Socket commands */
-
-enum winbindd_cmd {
-
-       WINBINDD_INTERFACE_VERSION,    /* Always a well known value */
-
-       /* Get users and groups */
-
-       WINBINDD_GETPWNAM,
-       WINBINDD_GETPWUID,
-       WINBINDD_GETGRNAM,
-       WINBINDD_GETGRGID,
-       WINBINDD_GETGROUPS,
-
-       /* Enumerate users and groups */
-
-       WINBINDD_SETPWENT,
-       WINBINDD_ENDPWENT,
-       WINBINDD_GETPWENT,
-       WINBINDD_SETGRENT,
-       WINBINDD_ENDGRENT,
-       WINBINDD_GETGRENT,
-
-       /* PAM authenticate and password change */
-
-       WINBINDD_PAM_AUTH,
-       WINBINDD_PAM_AUTH_CRAP,
-       WINBINDD_PAM_CHAUTHTOK,
-
-       /* List various things */
-
-       WINBINDD_LIST_USERS,         /* List w/o rid->id mapping */
-       WINBINDD_LIST_GROUPS,        /* Ditto */
-       WINBINDD_LIST_TRUSTDOM,
-
-       /* SID conversion */
-
-       WINBINDD_LOOKUPSID,
-       WINBINDD_LOOKUPNAME,
-
-       /* Lookup functions */
-
-       WINBINDD_SID_TO_UID,       
-       WINBINDD_SID_TO_GID,
-       WINBINDD_UID_TO_SID,
-       WINBINDD_GID_TO_SID,
-
-       /* Miscellaneous other stuff */
-
-       WINBINDD_CHECK_MACHACC,     /* Check machine account pw works */
-       WINBINDD_PING,              /* Just tell me winbind is running */
-       WINBINDD_INFO,              /* Various bit of info.  Currently just tidbits */
-
-       /* Placeholder for end of cmd list */
-
-       WINBINDD_NUM_CMDS
-};
-
-/* Winbind request structure */
-
-struct winbindd_request {
-       uint32 length;
-       enum winbindd_cmd cmd;   /* Winbindd command to execute */
-       pid_t pid;               /* pid of calling process */
-
-       union {
-               fstring username;    /* getpwnam */
-               fstring groupname;   /* getgrnam */
-               uid_t uid;           /* getpwuid, uid_to_sid */
-               gid_t gid;           /* getgrgid, gid_to_sid */
-               struct {
-                       fstring user;
-                       fstring pass;
-               } auth;              /* pam_winbind auth module */
-                struct {
-                        unsigned char chal[8];
-                        fstring user;
-                        fstring domain;
-                        fstring lm_resp;
-                        uint16 lm_resp_len;
-                        fstring nt_resp;
-                        uint16 nt_resp_len;
-                } auth_crap;
-                struct {
-                    fstring user;
-                    fstring oldpass;
-                    fstring newpass;
-                } chauthtok;         /* pam_winbind passwd module */
-               fstring sid;         /* lookupsid, sid_to_[ug]id */
-               fstring name;        /* lookupname */
-               uint32 num_entries;  /* getpwent, getgrent */
-       } data;
-       fstring domain;      /* {set,get,end}{pw,gr}ent() */
-};
-
-/* Response values */
-
-enum winbindd_result {
-       WINBINDD_ERROR,
-       WINBINDD_OK
-};
-
-/* Winbind response structure */
-
-struct winbindd_response {
-    
-       /* Header information */
-
-       uint32 length;                        /* Length of response */
-       enum winbindd_result result;          /* Result code */
-
-       /* Fixed length return data */
-       
-       union {
-               int interface_version;  /* Try to ensure this is always in the same spot... */
-               
-               /* getpwnam, getpwuid */
-               
-               struct winbindd_pw {
-                       fstring pw_name;
-                       fstring pw_passwd;
-                       uid_t pw_uid;
-                       gid_t pw_gid;
-                       fstring pw_gecos;
-                       fstring pw_dir;
-                       fstring pw_shell;
-               } pw;
-
-               /* getgrnam, getgrgid */
-
-               struct winbindd_gr {
-                       fstring gr_name;
-                       fstring gr_passwd;
-                       gid_t gr_gid;
-                       int num_gr_mem;
-                       int gr_mem_ofs;   /* offset to group membership */
-               } gr;
-
-               uint32 num_entries; /* getpwent, getgrent */
-               struct winbindd_sid {
-                       fstring sid;        /* lookupname, [ug]id_to_sid */
-                       int type;
-               } sid;
-               struct winbindd_name {
-                       fstring name;       /* lookupsid */
-                       int type;
-               } name;
-               uid_t uid;          /* sid_to_uid */
-               gid_t gid;          /* sid_to_gid */
-               struct winbindd_info {
-                       char winbind_separator;
-                       fstring samba_version;
-               } info;
-       } data;
-
-       /* Variable length return data */
-
-       void *extra_data;               /* getgrnam, getgrgid, getgrent */
-};
-
-#endif
index 2d47c44793064b435313ad81c31830c719694cca..ca8dfa02157714ea386113fc9c865767f23e7673 100755 (executable)
@@ -1,12 +1,12 @@
 #
 #  Makefile for the wb_group external_acl helper
 #
-#  $Id: Makefile.am,v 1.4 2003/01/23 00:36:20 robertc Exp $
+#  $Id: Makefile.am,v 1.5 2003/02/11 14:34:41 hno Exp $
 #
 
 libexec_PROGRAMS = wb_group
-wb_group_SOURCES = wb_check_group.c wb_common.c samba_nss.h winbindd_nss.h wbntlm.h winbind_nss_config.h
+wb_group_SOURCES = wb_check_group.c wb_common.c wbntlm.h
 EXTRA_DIST = readme.txt
 INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-    -I$(top_srcdir)/src
+    -I$(top_srcdir)/src -I@SAMBASOURCES@
 LDADD = -L$(top_builddir)/lib $(XTRA_LIBS)
diff --git a/helpers/external_acl/winbind_group/samba_nss.h b/helpers/external_acl/winbind_group/samba_nss.h
deleted file mode 100755 (executable)
index 6165e0b..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef _NSSWITCH_NSS_H
-#define _NSSWITCH_NSS_H
-/* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
-
-   a common place to work out how to define NSS_STATUS on various
-   platforms
-
-   Copyright (C) Tim Potter 2000
-   
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
-   This library 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
-   Library General Public License for more details.
-   
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the
-   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA  02111-1307, USA.   
-*/
-
-#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>
-
-typedef enum nss_status NSS_STATUS;
-
-#elif HAVE_NS_API_H
-
-/* SGI IRIX */
-
-/* following required to prevent warnings of double definition
- * of datum from ns_api.h
-*/
-#ifdef DATUM
-#define _DATUM_DEFINED
-#endif
-
-#include <ns_api.h>
-
-typedef enum
-{
-  NSS_STATUS_SUCCESS=NS_SUCCESS,
-  NSS_STATUS_NOTFOUND=NS_NOTFOUND,
-  NSS_STATUS_UNAVAIL=NS_UNAVAIL,
-  NSS_STATUS_TRYAGAIN=NS_TRYAGAIN
-} NSS_STATUS;
-
-#define NSD_MEM_STATIC 0
-#define NSD_MEM_VOLATILE 1
-#define NSD_MEM_DYNAMIC 2
-
-#elif defined(HPUX)
-/* HP-UX 11 */
-
-#include "nsswitch/hp_nss_common.h"
-#include "nsswitch/hp_nss_dbdefs.h"
-#include <nsswitch.h>
-
-#ifndef _HAVE_TYPEDEF_NSS_STATUS
-#define _HAVE_TYPEDEF_NSS_STATUS
-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
-#endif /* HPUX */
-
-#else /* Nothing's defined. Neither gnu nor sun nor hp */
-
-typedef enum
-{
-  NSS_STATUS_SUCCESS=0,
-  NSS_STATUS_NOTFOUND=1,
-  NSS_STATUS_UNAVAIL=2,
-  NSS_STATUS_TRYAGAIN=3
-} NSS_STATUS;
-
-#endif
-
-#endif /* _NSSWITCH_NSS_H */
index e6255abb6c8505a2e88ad35477200a5d98ae3dd7..fe250c0c07c50e595e61871385ebc3c7ffcb7c79 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * $Id: wb_check_group.c,v 1.8 2003/01/23 00:36:20 robertc Exp $
+ * $Id: wb_check_group.c,v 1.9 2003/02/11 14:34:41 hno Exp $
  *
  * This is a helper for the external ACL interface for Squid Cache
  * Copyright (C) 2002 Guido Serassio <squidnt@serassio.it>
@@ -38,8 +38,8 @@
 #include <string.h>
 #include <ctype.h>
 
-#include "winbind_nss_config.h"
-#include "winbindd_nss.h"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbindd_nss.h"
 
 #define BUFSIZE 8192           /* the stdin buffer size */
 char debug_enabled=0;
index 1049529452eb9ffb1ee3e852dbf08eb0abe2ff3a..785ef86ffe1f493f3c41dd68e09f2480f25a734f 100755 (executable)
@@ -23,8 +23,8 @@
    Boston, MA  02111-1307, USA.   
 */
 
-#include "winbind_nss_config.h"
-#include "winbindd_nss.h"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbindd_nss.h"
 #include "config.h"
 
 
diff --git a/helpers/external_acl/winbind_group/winbind_nss_config.h b/helpers/external_acl/winbind_group/winbind_nss_config.h
deleted file mode 100755 (executable)
index ac80f4a..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
-
-   Winbind daemon for ntdom nss module
-
-   Copyright (C) Tim Potter 2000
-   
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
-   This library 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
-   Library General Public License for more details.
-   
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the
-   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA  02111-1307, USA.   
-*/
-
-#ifndef _WINBIND_NSS_CONFIG_H
-#define _WINBIND_NSS_CONFIG_H
-
-/* Include header files from data in config.h file */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_UNIXSOCKET
-#include <sys/un.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <pwd.h>
-#include "samba_nss.h"
-
-/* 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. */
-
-#ifndef _PSTRING
-#define _PSTRING
-#define PSTRING_LEN 1024
-#define FSTRING_LEN 256
-typedef char pstring[PSTRING_LEN];
-typedef char fstring[FSTRING_LEN];
-#endif
-
-#ifndef _BOOL
-#define _BOOL                  /* So we don't typedef BOOL again in vfs.h */
-#define False (0)
-#define True (1)
-#define Auto (2)
-typedef int BOOL;
-#endif
-
-#if !defined(uint32)
-#if (SIZEOF_INT == 4)
-#define uint32 unsigned int
-#elif (SIZEOF_LONG == 4)
-#define uint32 unsigned long
-#elif (SIZEOF_SHORT == 4)
-#define uint32 unsigned short
-#endif
-#endif
-
-#if !defined(uint16)
-#if (SIZEOF_SHORT == 4)
-#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
-#else /* SIZEOF_SHORT != 4 */
-#define uint16 unsigned short
-#endif /* SIZEOF_SHORT != 4 */
-#endif
-
-#ifndef uint8
-#define uint8 unsigned char
-#endif
-
-/* zero a structure */
-#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
-
-/* 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
-#define S_IFSOCK S_IFIFO
-#endif
-
-#ifndef S_ISSOCK
-#define S_ISSOCK(mode)  ((mode & S_IFSOCK) == S_IFSOCK)
-#endif
-
-#endif
index 6983fd1980f8346ca368530669753037c620e8c4..1b9717e00da1f46a3a042c4dd28570c146e9fdc8 100644 (file)
@@ -1,14 +1,14 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.6 2003/01/23 00:36:40 robertc Exp $
+#  $Id: Makefile.am,v 1.7 2003/02/11 14:34:41 hno Exp $
 #
 
 libexec_PROGRAMS = wb_ntlmauth
-wb_ntlmauth_SOURCES = wb_ntlm_auth.c wb_common.c samba_nss.h winbindd_nss.h wbntlm.h winbind_nss_config.h
+wb_ntlmauth_SOURCES = wb_ntlm_auth.c wb_common.c wbntlm.h
 EXTRA_DIST = \
        patches/wb_common.patch \
        patches/winbind_nss_config.patch
 INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-    -I$(top_srcdir)/src
+    -I$(top_srcdir)/src -I@SAMBASOURCES@
 LDADD = -L$(top_builddir)/lib -lmiscutil -lntlmauth $(XTRA_LIBS)
diff --git a/helpers/ntlm_auth/winbind/samba_nss.h b/helpers/ntlm_auth/winbind/samba_nss.h
deleted file mode 100644 (file)
index 6165e0b..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef _NSSWITCH_NSS_H
-#define _NSSWITCH_NSS_H
-/* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
-
-   a common place to work out how to define NSS_STATUS on various
-   platforms
-
-   Copyright (C) Tim Potter 2000
-   
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
-   This library 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
-   Library General Public License for more details.
-   
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the
-   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA  02111-1307, USA.   
-*/
-
-#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>
-
-typedef enum nss_status NSS_STATUS;
-
-#elif HAVE_NS_API_H
-
-/* SGI IRIX */
-
-/* following required to prevent warnings of double definition
- * of datum from ns_api.h
-*/
-#ifdef DATUM
-#define _DATUM_DEFINED
-#endif
-
-#include <ns_api.h>
-
-typedef enum
-{
-  NSS_STATUS_SUCCESS=NS_SUCCESS,
-  NSS_STATUS_NOTFOUND=NS_NOTFOUND,
-  NSS_STATUS_UNAVAIL=NS_UNAVAIL,
-  NSS_STATUS_TRYAGAIN=NS_TRYAGAIN
-} NSS_STATUS;
-
-#define NSD_MEM_STATIC 0
-#define NSD_MEM_VOLATILE 1
-#define NSD_MEM_DYNAMIC 2
-
-#elif defined(HPUX)
-/* HP-UX 11 */
-
-#include "nsswitch/hp_nss_common.h"
-#include "nsswitch/hp_nss_dbdefs.h"
-#include <nsswitch.h>
-
-#ifndef _HAVE_TYPEDEF_NSS_STATUS
-#define _HAVE_TYPEDEF_NSS_STATUS
-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
-#endif /* HPUX */
-
-#else /* Nothing's defined. Neither gnu nor sun nor hp */
-
-typedef enum
-{
-  NSS_STATUS_SUCCESS=0,
-  NSS_STATUS_NOTFOUND=1,
-  NSS_STATUS_UNAVAIL=2,
-  NSS_STATUS_TRYAGAIN=3
-} NSS_STATUS;
-
-#endif
-
-#endif /* _NSSWITCH_NSS_H */
index 1a1f5c02520bf0a5081cf0be6be0695f35b6f06f..24adb1427ac377361d203a67453670ab3657dd91 100644 (file)
@@ -23,8 +23,8 @@
    Boston, MA  02111-1307, USA.   
 */
 
-#include "winbind_nss_config.h"
-#include "winbindd_nss.h"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbindd_nss.h"
 #include "config.h"
 
 
index 463d071cd2e7ffdac9c9b70d0592c0f569f514cc..c14fa5994344e6fda6952b4c93be49397b82bfa4 100644 (file)
@@ -44,8 +44,8 @@
 #include <getopt.h>
 #endif
 
-#include "winbind_nss_config.h"
-#include "winbindd_nss.h"
+#include "nsswitch/winbind_nss_config.h"
+#include "nsswitch/winbindd_nss.h"
 
 #ifndef min
 #define min(x,y) ((x)<(y)?(x):(y))
diff --git a/helpers/ntlm_auth/winbind/winbindd_nss.h b/helpers/ntlm_auth/winbind/winbindd_nss.h
deleted file mode 100644 (file)
index 476dc71..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-
-   Winbind daemon for ntdom nss module
-
-   Copyright (C) Tim Potter 2000
-   
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
-   This library 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
-   Library General Public License for more details.
-   
-   You should have received a copy of the GNU Library General Public
-   License along with this library; if not, write to the
-   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA  02111-1307, USA.   
-*/
-
-#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
-#endif
-
-#ifndef _WINBINDD_NTDOM_H
-#define _WINBINDD_NTDOM_H
-
-#define WINBINDD_SOCKET_NAME "pipe"            /* Name of PF_UNIX socket */
-#define WINBINDD_SOCKET_DIR  "/tmp/.winbindd"  /* Name of PF_UNIX dir */
-
-#define WINBINDD_DOMAIN_ENV  "WINBINDD_DOMAIN" /* Environment variables */
-#define WINBINDD_DONT_ENV    "_NO_WINBINDD"
-
-/* Update this when you change the interface.  */
-
-#define WINBIND_INTERFACE_VERSION 4
-
-/* Socket commands */
-
-enum winbindd_cmd {
-
-       WINBINDD_INTERFACE_VERSION,    /* Always a well known value */
-
-       /* Get users and groups */
-
-       WINBINDD_GETPWNAM,
-       WINBINDD_GETPWUID,
-       WINBINDD_GETGRNAM,
-       WINBINDD_GETGRGID,
-       WINBINDD_GETGROUPS,
-
-       /* Enumerate users and groups */
-
-       WINBINDD_SETPWENT,
-       WINBINDD_ENDPWENT,
-       WINBINDD_GETPWENT,
-       WINBINDD_SETGRENT,
-       WINBINDD_ENDGRENT,
-       WINBINDD_GETGRENT,
-
-       /* PAM authenticate and password change */
-
-       WINBINDD_PAM_AUTH,
-       WINBINDD_PAM_AUTH_CRAP,
-       WINBINDD_PAM_CHAUTHTOK,
-
-       /* List various things */
-
-       WINBINDD_LIST_USERS,         /* List w/o rid->id mapping */
-       WINBINDD_LIST_GROUPS,        /* Ditto */
-       WINBINDD_LIST_TRUSTDOM,
-
-       /* SID conversion */
-
-       WINBINDD_LOOKUPSID,
-       WINBINDD_LOOKUPNAME,
-
-       /* Lookup functions */
-
-       WINBINDD_SID_TO_UID,       
-       WINBINDD_SID_TO_GID,
-       WINBINDD_UID_TO_SID,
-       WINBINDD_GID_TO_SID,
-
-       /* Miscellaneous other stuff */
-
-       WINBINDD_CHECK_MACHACC,     /* Check machine account pw works */
-       WINBINDD_PING,              /* Just tell me winbind is running */
-       WINBINDD_INFO,              /* Various bit of info.  Currently just tidbits */
-       WINBINDD_DOMAIN_NAME,       /* The domain this winbind server is a member of (lp_workgroup()) */
-
-       WINBINDD_SHOW_SEQUENCE, /* display sequence numbers of domains */
-
-       /* Placeholder for end of cmd list */
-
-       WINBINDD_NUM_CMDS
-};
-
-/* Winbind request structure */
-
-struct winbindd_request {
-       uint32 length;
-       enum winbindd_cmd cmd;   /* Winbindd command to execute */
-       pid_t pid;               /* pid of calling process */
-
-       union {
-               fstring username;    /* getpwnam */
-               fstring groupname;   /* getgrnam */
-               uid_t uid;           /* getpwuid, uid_to_sid */
-               gid_t gid;           /* getgrgid, gid_to_sid */
-               struct {
-                       fstring user;
-                       fstring pass;
-               } auth;              /* pam_winbind auth module */
-                struct {
-                        unsigned char chal[8];
-                        fstring user;
-                        fstring domain;
-                        fstring lm_resp;
-                        uint16 lm_resp_len;
-                        fstring nt_resp;
-                        uint16 nt_resp_len;
-                } auth_crap;
-                struct {
-                    fstring user;
-                    fstring oldpass;
-                    fstring newpass;
-                } chauthtok;         /* pam_winbind passwd module */
-               fstring sid;         /* lookupsid, sid_to_[ug]id */
-               struct {
-                       fstring dom_name;       /* lookupname */
-                       fstring name;       
-               } name;
-               uint32 num_entries;  /* getpwent, getgrent */
-       } data;
-       fstring domain;      /* {set,get,end}{pw,gr}ent() */
-};
-
-/* Response values */
-
-enum winbindd_result {
-       WINBINDD_ERROR,
-       WINBINDD_OK
-};
-
-/* Winbind response structure */
-
-struct winbindd_response {
-    
-       /* Header information */
-
-       uint32 length;                        /* Length of response */
-       enum winbindd_result result;          /* Result code */
-
-       /* Fixed length return data */
-       
-       union {
-               int interface_version;  /* Try to ensure this is always in the same spot... */
-               
-               /* getpwnam, getpwuid */
-               
-               struct winbindd_pw {
-                       fstring pw_name;
-                       fstring pw_passwd;
-                       uid_t pw_uid;
-                       gid_t pw_gid;
-                       fstring pw_gecos;
-                       fstring pw_dir;
-                       fstring pw_shell;
-               } pw;
-
-               /* getgrnam, getgrgid */
-
-               struct winbindd_gr {
-                       fstring gr_name;
-                       fstring gr_passwd;
-                       gid_t gr_gid;
-                       int num_gr_mem;
-                       int gr_mem_ofs;   /* offset to group membership */
-               } gr;
-
-               uint32 num_entries; /* getpwent, getgrent */
-               struct winbindd_sid {
-                       fstring sid;        /* lookupname, [ug]id_to_sid */
-                       int type;
-               } sid;
-               struct winbindd_name {
-                       fstring dom_name;       /* lookupsid */
-                       fstring name;       
-                       int type;
-               } name;
-               uid_t uid;          /* sid_to_uid */
-               gid_t gid;          /* sid_to_gid */
-               struct winbindd_info {
-                       char winbind_separator;
-                       fstring samba_version;
-               } info;
-               fstring domain_name;
-
-               struct auth_reply {
-                       uint32 nt_status;
-                       fstring nt_status_string;
-                       fstring error_string;
-                       int pam_error;
-               } auth;
-       } data;
-
-       /* Variable length return data */
-
-       void *extra_data;               /* getgrnam, getgrgid, getgrent */
-};
-
-#endif
diff --git a/include/samba/README.txt b/include/samba/README.txt
new file mode 100644 (file)
index 0000000..2b2cd20
--- /dev/null
@@ -0,0 +1,7 @@
+These files are copies of Samba internal headers from Samba-2.2.7a
+required by the winbind helpers to Squid.
+
+If you compile the winbind helpers with other versions of Samba you may
+need to copy the relevant headers from the Samba version you are using
+here, or use the --with-samba-source=... configure option to tell Squid
+where the Samba sources can be found.
similarity index 93%
rename from helpers/basic_auth/winbind/samba_nss.h
rename to include/samba/nsswitch/sys_nss.h
index 6165e0b24a5543dd46dbce700c13326ad72031ea..b4dfc1fa336dbbeda2820bc9610277706353c292 100644 (file)
@@ -1,8 +1,7 @@
-#ifndef _NSSWITCH_NSS_H
-#define _NSSWITCH_NSS_H
+#ifndef _NSSWITCH_SYS_NSS_H
+#define _NSSWITCH_SYS_NSS_H
 /* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
+   Unix SMB/CIFS implementation.
 
    a common place to work out how to define NSS_STATUS on various
    platforms
@@ -73,7 +72,7 @@ typedef enum
 #define NSD_MEM_VOLATILE 1
 #define NSD_MEM_DYNAMIC 2
 
-#elif defined(HPUX)
+#elif defined(HPUX) && defined(HAVE_NSSWITCH_H)
 /* HP-UX 11 */
 
 #include "nsswitch/hp_nss_common.h"
@@ -102,4 +101,4 @@ typedef enum
 
 #endif
 
-#endif /* _NSSWITCH_NSS_H */
+#endif /* _NSSWITCH_SYS_NSS_H */
similarity index 94%
rename from helpers/ntlm_auth/winbind/winbind_nss_config.h
rename to include/samba/nsswitch/winbind_nss_config.h
index ac80f4adc21d433d13f8dd9813bc80af5b066416..eac80994fc3f83e17f79cf9991fbb2c44b3171c7 100644 (file)
@@ -1,6 +1,5 @@
 /* 
-   Unix SMB/Netbios implementation.
-   Version 2.0
+   Unix SMB/CIFS implementation.
 
    Winbind daemon for ntdom nss module
 
@@ -27,7 +26,7 @@
 
 /* Include header files from data in config.h file */
 
-#include "config.h"
+#include <config.h>
 
 #include <stdio.h>
 
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -63,7 +66,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <pwd.h>
-#include "samba_nss.h"
+#include "nsswitch/sys_nss.h"
 
 /* Declarations for functions in winbind_nss.c
    needed in winbind_nss_solaris.c (solaris wrapper to nss) */
@@ -130,11 +133,15 @@ typedef int BOOL;
 #endif
 
 /* zero a structure */
+#ifndef ZERO_STRUCT
 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
+#endif
 
 /* zero a structure given a pointer to the structure */
+#ifndef ZERO_STRUCTP
 #define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
-    
+#endif
+
 /* Some systems (SCO) treat UNIX domain sockets as FIFOs */
 
 #ifndef S_IFSOCK
old mode 100755 (executable)
new mode 100644 (file)
similarity index 96%
rename from helpers/external_acl/winbind_group/winbindd_nss.h
rename to include/samba/nsswitch/winbindd_nss.h
index 023d723..28a32ee
@@ -118,6 +118,9 @@ struct winbindd_request {
                uid_t uid;           /* getpwuid, uid_to_sid */
                gid_t gid;           /* getgrgid, gid_to_sid */
                struct {
+                       /* We deliberatedly don't split into domain/user to
+                           avoid having the client know what the separator
+                           character is. */    
                        fstring user;
                        fstring pass;
                } auth;              /* pam_winbind auth module */
@@ -216,6 +219,8 @@ struct winbindd_response {
                } auth;
        } data;
 
+       uint32 nt_status;       /* Extended error information */
+
        /* Variable length return data */
 
        void *extra_data;               /* getgrnam, getgrgid, getgrent */