Makefile, loadparm.c, server.c, smb.h, util.c: Patch from
authorJeremy Allison <jra@samba.org>
Thu, 9 Apr 1998 20:48:48 +0000 (20:48 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 9 Apr 1998 20:48:48 +0000 (20:48 +0000)
stn@techfak.uni-kiel.de (Stefan Nehlsen) to get homes from
the NIS+ map.
smbpasswd.c: Tidy up of cli_state structure.
Jeremy.

source/include/proto.h
source/include/smb.h
source/lib/util.c
source/param/loadparm.c
source/smbd/server.c
source/utils/smbpasswd.c

index 993cf46486bd9b277bcb88fb23cf5710731d2782..ad9a36ca620e4cd542169bb3fb809898690306ca 100644 (file)
@@ -1750,9 +1750,6 @@ int reply_findnclose(char *inbuf,char *outbuf,int length,int bufsize);
 int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize);
 int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize);
 
-/*The following definitions come from  ubiqx/ubi_dLinkList.c  */
-
-
 /*The following definitions come from  ufc.c  */
 
 char *ufc_crypt(char *key,char *salt);
index 21bf346c6225031feffdc3486b1e73a3564c3a17..33c483d54cf31a0cb252a51932c8ca82b18d1e8b 100644 (file)
@@ -887,7 +887,7 @@ struct parm_struct
 #define smb_base(buf) (((char *)(buf))+4)
 
 
-#define SUCCESS 0  /* The request was successful. */
+#define SMB_SUCCESS 0  /* The request was successful. */
 #define ERRDOS 0x01 /*  Error is from the core DOS operating system set. */
 #define ERRSRV 0x02  /* Error is generated by the server network file manager.*/
 #define ERRHRD 0x03  /* Error is an hardware error. */
index 3173d52692777704b5b76d5dba1c614b881244dc..484dfe21bd1ac61e7e3185854de2fadcbdf3d52c 100644 (file)
 #include "includes.h"
 
 #if (defined(NETGROUP) && defined (AUTOMOUNT))
+#ifdef NISPLUS
+#include <rpcsvc/nis.h>
+#else
 #include "rpcsvc/ypclnt.h"
 #endif
+#endif
 
 pstring scope = "";
 
@@ -3811,6 +3815,58 @@ char *client_addr(int fd)
 *******************************************************************/
 
 #if (defined(NETGROUP) && defined(AUTOMOUNT))
+#ifdef NISPLUS
+static char *automount_lookup(char *user_name)
+{
+  static fstring last_key = "";
+  static pstring last_value = "";
+  char *nis_map = (char *)lp_nis_home_map_name();
+  char nis_domain[NIS_MAXNAMELEN + 1];
+  char buffer[NIS_MAXATTRVAL + 1];
+  nis_result *result;
+  nis_object *object;
+  entry_obj  *entry;
+  strncpy(nis_domain, (char *)nis_local_directory(), NIS_MAXNAMELEN);
+  nis_domain[NIS_MAXNAMELEN] = '\0';
+  DEBUG(5, ("NIS+ Domain: %s\n", nis_domain));
+  if (strcmp(user_name, last_key))
+  {
+    sprintf(buffer, "[%s=%s]%s.%s", "key", user_name, nis_map, nis_domain);
+    DEBUG(5, ("NIS+ querystring: %s\n", buffer));
+    if (result = nis_list(buffer, RETURN_RESULT, NULL, NULL))
+    {
+       if (result->status != NIS_SUCCESS)
+      {
+        DEBUG(3, ("NIS+ query failed: %s\n", nis_sperrno(result->status)));
+        fstrcpy(last_key, ""); pstrcpy(last_value, "");
+      }
+      else
+      {
+        object = result->objects.objects_val;
+        if (object->zo_data.zo_type == ENTRY_OBJ)
+        {
+           entry = &object->zo_data.objdata_u.en_data;
+           DEBUG(5, ("NIS+ entry type: %s\n", entry->en_type));
+           DEBUG(3, ("NIS+ result: %s\n", entry->en_cols.en_cols_val[1].ec_value.ec_value_val));
+           pstrcpy(last_value, entry->en_cols.en_cols_val[1].ec_value.ec_value_val);
+           string_sub(last_value, "&", user_name);
+           fstrcpy(last_key, user_name);
+        }
+      }
+    }
+    nis_freeresult(result);
+  }
+  DEBUG(4, ("NIS+ Lookup: %s resulted in %s\n", user_name, last_value));
+  return last_value;
+}
+#else /* NISPLUS */
 static char *automount_lookup(char *user_name)
 {
   static fstring last_key = "";
@@ -3857,6 +3913,7 @@ static char *automount_lookup(char *user_name)
   DEBUG(4, ("YP Lookup: %s resulted in %s\n", user_name, last_value));
   return last_value;
 }
+#endif /* NISPLUS */
 #endif
 
 /*******************************************************************
index 837632788e8cdc62fe4dac9d3451fe6d0bfc2194..da9d2f77a576806c12d8513d0be4b508d78c698a 100644 (file)
@@ -740,7 +740,11 @@ static void init_globals(void)
   Globals.bUnixRealname = False;
 #if (defined(NETGROUP) && defined(AUTOMOUNT))
   Globals.bNISHomeMap = False;
+#ifdef NISPLUS
+  string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
+#else
   string_set(&Globals.szNISHomeMapName, "auto.home");
+#endif
 #endif
   Globals.client_code_page = DEFAULT_CLIENT_CODE_PAGE;
   Globals.bTimeServer = False;
index d0b0304430c37fc25f371c61eec00295bdc2bf82..01f9006a42a37dd1044d96f7c25cf370260eba78 100644 (file)
@@ -101,7 +101,7 @@ extern fstring remote_machine;
 extern pstring OriginalDir;
 
 /* these can be set by some functions to override the error codes */
-int unix_ERR_class=SUCCESS;
+int unix_ERR_class=SMB_SUCCESS;
 int unix_ERR_code=0;
 
 
@@ -2303,11 +2303,11 @@ int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int
   int ecode=def_code;
   int i=0;
 
-  if (unix_ERR_class != SUCCESS)
+  if (unix_ERR_class != SMB_SUCCESS)
     {
       eclass = unix_ERR_class;
       ecode = unix_ERR_code;
-      unix_ERR_class = SUCCESS;
+      unix_ERR_class = SMB_SUCCESS;
       unix_ERR_code = 0;
     }
   else
@@ -4686,12 +4686,12 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
   CVAL(outbuf2,smb_com) = CVAL(inbuf2,smb_com);
   
   memcpy(outbuf2+4,inbuf2+4,4);
-  CVAL(outbuf2,smb_rcls) = SUCCESS;
+  CVAL(outbuf2,smb_rcls) = SMB_SUCCESS;
   CVAL(outbuf2,smb_reh) = 0;
   CVAL(outbuf2,smb_flg) = 0x80 | (CVAL(inbuf2,smb_flg) & 0x8); /* bit 7 set 
                                                                  means a reply */
   SSVAL(outbuf2,smb_flg2,1); /* say we support long filenames */
-  SSVAL(outbuf2,smb_err,SUCCESS);
+  SSVAL(outbuf2,smb_err,SMB_SUCCESS);
   SSVAL(outbuf2,smb_tid,SVAL(inbuf2,smb_tid));
   SSVAL(outbuf2,smb_pid,SVAL(inbuf2,smb_pid));
   SSVAL(outbuf2,smb_uid,SVAL(inbuf2,smb_uid));
@@ -4748,12 +4748,12 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize)
   set_message(outbuf,0,0,True);
   
   memcpy(outbuf+4,inbuf+4,4);
-  CVAL(outbuf,smb_rcls) = SUCCESS;
+  CVAL(outbuf,smb_rcls) = SMB_SUCCESS;
   CVAL(outbuf,smb_reh) = 0;
   CVAL(outbuf,smb_flg) = 0x80 | (CVAL(inbuf,smb_flg) & 0x8); /* bit 7 set 
                                                             means a reply */
   SSVAL(outbuf,smb_flg2,1); /* say we support long filenames */
-  SSVAL(outbuf,smb_err,SUCCESS);
+  SSVAL(outbuf,smb_err,SMB_SUCCESS);
   SSVAL(outbuf,smb_tid,SVAL(inbuf,smb_tid));
   SSVAL(outbuf,smb_pid,SVAL(inbuf,smb_pid));
   SSVAL(outbuf,smb_uid,SVAL(inbuf,smb_uid));
index 425308bec637132bc1e52134fef022cce07b75c5..2433fa1bb42d45cfb837ddcb51907982896ec6c5 100644 (file)
@@ -693,7 +693,7 @@ int main(int argc, char **argv)
       exit(1);
     }
  
-    cli.error = 0;
+    memset(&cli, '\0', sizeof(struct cli_state));
  
     if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) {
       fprintf(stderr, "%s: unable to connect to SMB server on machine %s. Error was : %s.\n",