home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 20 NDrivers / 20-NDrivers.zip / samba193.zip / patches.os2 < prev    next >
Text File  |  1996-04-17  |  10KB  |  359 lines

  1. diff -u orig-source/client.c source/client.c
  2. --- orig-source/client.c    Mon Jan 15 21:56:44 1996
  3. +++ source/client.c    Wed Apr 17 11:41:06 1996
  4. @@ -2076,6 +2076,8 @@
  5.    pstring rname;
  6.    file_info finfo;
  7.    fstring buf;
  8. +  pstring quest;
  9. +
  10.    char *p=buf;
  11.  
  12.    finfo = def_finfo;
  13. @@ -2084,6 +2086,19 @@
  14.    while (next_token(NULL,p,NULL))
  15.      {
  16.        struct stat st;
  17. +      int i ;
  18. +
  19. +#ifdef USE_GLOB
  20. +      /* No recursion using GLOB, but faster, and portable (POSIX.2) */
  21. +      glob_t filelist ;
  22. +      /* GLOB_NOESCAPE included in case user uses \ for path seperator on OS/2 */
  23. +      if (glob(p,GLOB_NOESCAPE|GLOB_NOSORT,NULL,&filelist ) != 0)
  24. +        continue ;
  25. +
  26. +      for (i=0; i<filelist.gl_pathc; i++)
  27. +        {
  28. +          strcpy( lname, filelist.gl_pathv[i] ) ; 
  29. +#else
  30.        pstring cmd;
  31.        pstring tmpname;
  32.        FILE *f;
  33. @@ -2100,9 +2115,10 @@
  34.  
  35.        while (!feof(f))
  36.      {
  37. -      pstring quest;
  38. -
  39.        if (fscanf(f,"%s",lname) != 1) break;
  40. +
  41. +#endif /* USE_GLOB */
  42. +
  43.        trim_string(lname,"./",NULL);
  44.  
  45.      again1:
  46. @@ -2115,8 +2131,10 @@
  47.            if (prompt && !yesno(quest)) 
  48.          {
  49.            strcat(lname,"/");
  50. +#ifndef USE_GLOB
  51.            if (!seek_list(f,lname))
  52.              break;
  53. +#endif
  54.            goto again1;            
  55.          }
  56.            
  57. @@ -2125,8 +2143,10 @@
  58.            if (!do_mkdir(rname))
  59.          {
  60.            strcat(lname,"/");
  61. +#ifndef USE_GLOB
  62.            if (!seek_list(f,lname))
  63.              break;
  64. +#endif
  65.            goto again1;                      
  66.          }
  67.  
  68. @@ -2150,8 +2170,13 @@
  69.  
  70.        do_put(rname,lname,&finfo);
  71.      }
  72. +
  73. +#ifdef USE_GLOB
  74. +      globfree(&filelist) ;
  75. +#else
  76.        fclose(f);
  77.        unlink(tmpname);
  78. +#endif
  79.      }
  80.  }
  81.  
  82. @@ -3091,7 +3116,11 @@
  83.      memcpy(p,pword,passlen); p += SVAL(outbuf,smb_vwv7);
  84.      strcpy(p,username);p = skip_string(p,1);
  85.      strcpy(p,workgroup);p = skip_string(p,1);
  86. +#ifdef OS2
  87. +    strcpy(p,"OS/2");p = skip_string(p,1);
  88. +#else
  89.      strcpy(p,"Unix");p = skip_string(p,1);
  90. +#endif
  91.      strcpy(p,"Samba");p = skip_string(p,1);
  92.      set_message(outbuf,13,PTR_DIFF(p,smb_buf(outbuf)),False);
  93.        }
  94. @@ -4025,6 +4054,17 @@
  95.    extern char *optarg;
  96.    pstring query_host;
  97.    BOOL message = False;
  98. +
  99. +#ifdef STDIN_NEEDS_UNIX_SETUP
  100. +  /* OS/2 stdin is different, but EMX allows us to set it up to be more
  101. +   * Unix-like.  Still not perfect, but bearable
  102. +   */
  103. +  struct termio tio ;
  104. +
  105. +  ioctl( fileno(stdin), TCGETA, &tio ) ;
  106. +  tio.c_lflag ^= IDEFAULT ;
  107. +  ioctl( fileno(stdin), TCSETA, &tio ) ;
  108. +#endif
  109.  
  110.    *query_host = 0;
  111.  
  112. diff -u orig-source/includes.h source/includes.h
  113. --- orig-source/includes.h    Mon Jan 15 21:15:36 1996
  114. +++ source/includes.h    Mon Mar 18 10:42:06 1996
  115. @@ -102,6 +102,7 @@
  116.  #ifdef OS2
  117.  #define NO_SYSMOUNTH
  118.  #define NO_NETIFH
  119. +#define PAGER "more <"
  120.  #endif
  121.  
  122.  
  123. @@ -816,11 +817,15 @@
  124.  #ifdef OS2
  125.  #include <dirent.h>
  126.  #include <sys/statfs.h>
  127. +#include <sys/termio.h>
  128.  #include <string.h>
  129.  #include <limits.h>
  130. +#include <glob.h>
  131.  #define SIGNAL_CAST (void (*)())
  132.  #define HAVE_FCNTL_LOCK 0
  133.  #define USE_WAITPID
  134. +#define USE_GETCWD
  135. +#define getcwd _getcwd2
  136.  #define NO_GET_BROADCAST
  137.  #define NO_EID
  138.  #define NO_SETGROUPS
  139. @@ -829,6 +834,15 @@
  140.  #define NO_STATFS
  141.  #define NO_CHROOT
  142.  #define NO_CHOWN
  143. +#define BUGGY_OS2_SELECT
  144. +#define STDIN_NEEDS_UNIX_SETUP
  145. +#define HAVE_DRIVE_LETTERS
  146. +#define NO_SMBRUN
  147. +#define USE_GLOB
  148. +#define SYSV
  149. +#define SYSV_TERMIO
  150. +#define DEFAULT_PRINTING PRINT_BSD
  151. +#define NULL_DEVICE "nul"
  152.  #define strcasecmp stricmp
  153.  #define strncasecmp strnicmp
  154.  #endif
  155. @@ -837,6 +851,10 @@
  156.  /*******************************************************************
  157.  end of the platform specific sections
  158.  ********************************************************************/
  159. +
  160. +#ifndef NULL_DEVICE
  161. +#define NULL_DEVICE "/dev/null"
  162. +#endif
  163.  
  164.  #ifdef REPLACE_GETPASS
  165.  extern char    *getsmbpass(char *);
  166. diff -u orig-source/Makefile source/Makefile
  167. --- orig-source/Makefile    Mon Jan 15 21:02:02 1996
  168. +++ source/Makefile    Sun Feb 11 17:38:48 1996
  169. @@ -437,7 +437,7 @@
  170.  # This is for OS/2 using EMX 0.9b
  171.  # Contributed by jasonr@pec.co.nz (Jason Rumney)
  172.  # FLAGSM = -DOS2
  173. -# LIBSM = -Zexe -lsocket
  174. +# LIBSM = -Zexe -Zbin-files -lsocket
  175.  
  176.  
  177.  ######################################################################
  178. @@ -493,7 +493,7 @@
  179.      @echo Linking nmblookup
  180.      @$(CC) $(CFLAGS) -o nmblookup nmblookup.o nmblib.o $(UTILOBJ) $(LIBS)
  181.  
  182. -nmbd: nameserv.o nmblib.o nmbsync.o $(UTILOBJ) 
  183. +nmbd: nameserv.o nmblib.o nmbsync.o $(PARAMOBJ) 
  184.      @echo Linking nmbd
  185.      @$(CC) $(CFLAGS) -o nmbd nameserv.o nmblib.o nmbsync.o $(PARAMOBJ) $(LIBS)
  186.  
  187. diff -u orig-source/nameserv.c source/nameserv.c
  188. --- orig-source/nameserv.c    Mon Jan 15 20:38:56 1996
  189. +++ source/nameserv.c    Sun Feb 11 17:51:22 1996
  190. @@ -497,7 +497,7 @@
  191.    strcat(fname,"/");
  192.    strcat(fname,SERVER_LIST);
  193.    strcpy(fnamenew,fname);
  194. -  strcat(fnamenew,".");
  195. +  strcat(fnamenew,".new");
  196.    
  197.    f = fopen(fnamenew,"w");
  198.    
  199. diff -u orig-source/nmblib.c source/nmblib.c
  200. --- orig-source/nmblib.c    Mon Jan 15 20:39:22 1996
  201. +++ source/nmblib.c    Tue Feb 13 11:40:30 1996
  202. @@ -592,6 +592,7 @@
  203.  {
  204.    fd_set fds;
  205.    struct timeval timeout;
  206. +  int selrtn ;
  207.  
  208.    FD_ZERO(&fds);
  209.    FD_SET(fd,&fds);
  210. @@ -598,9 +599,9 @@
  211.    timeout.tv_sec = t/1000;
  212.    timeout.tv_usec = 1000*(t%1000);
  213.  
  214. -  sys_select(&fds,&timeout);
  215. +  selrtn = sys_select(&fds,&timeout);
  216.  
  217. -  if (FD_ISSET(fd,&fds)) 
  218. +  if (FD_ISSET(fd,&fds))
  219.      return(read_packet(fd,type));
  220.  
  221.    return(NULL);
  222. diff -u orig-source/printing.c source/printing.c
  223. --- orig-source/printing.c    Mon Jan 15 14:29:50 1996
  224. +++ source/printing.c    Wed Apr 17 12:50:08 1996
  225. @@ -590,7 +590,6 @@
  226.  }
  227.  
  228.  
  229. -
  230.  char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
  231.  char *stat1_strings[] = { "offline", "disabled", "down", "off", "waiting", "no daemon", NULL };
  232.  char *stat2_strings[] = { "jam", "paper", "error", "responding", "not accepting", "not running", "turned off", NULL };
  233. diff -u orig-source/reply.c source/reply.c
  234. --- orig-source/reply.c    Tue Jan 16 22:28:28 1996
  235. +++ source/reply.c    Wed Apr 17 11:40:10 1996
  236. @@ -413,7 +413,11 @@
  237.      char *p;
  238.      outsize = set_message(outbuf,3,3,True);
  239.      p = smb_buf(outbuf);
  240. +#ifdef OS2
  241. +    strcpy(p,"OS/2"); p = skip_string(p,1);
  242. +#else
  243.      strcpy(p,"Unix"); p = skip_string(p,1);
  244. +#endif
  245.      strcpy(p,"Samba "); strcat(p,VERSION); p = skip_string(p,1);
  246.      strcpy(p,my_workgroup()); p = skip_string(p,1);
  247.      outsize = set_message(outbuf,3,PTR_DIFF(p,smb_buf(outbuf)),False);
  248. diff -u orig-source/smbrun.c source/smbrun.c
  249. --- orig-source/smbrun.c    Thu Jun 29 21:20:06 1995
  250. +++ source/smbrun.c    Sun Feb 25 17:36:52 1996
  251. @@ -33,8 +33,8 @@
  252.    /* try and use up these file descriptors, so silly
  253.       library routines writing to stdout etc won't cause havoc */
  254.    for (i=0;i<3;i++) {
  255. -    fd = open("/dev/null",O_RDWR,0);
  256. -    if (fd < 0) fd = open("/dev/null",O_WRONLY,0);
  257. +    fd = open(NULL_DEVICE,O_RDWR,0);
  258. +    if (fd < 0) fd = open(NULL_DEVICE,O_WRONLY,0);
  259.      if (fd != i) return;
  260.    }
  261.  }
  262. diff -u orig-source/status.c source/status.c
  263. --- orig-source/status.c    Mon Jan 15 20:40:10 1996
  264. +++ source/status.c    Sun Feb 25 17:38:00 1996
  265. @@ -62,7 +62,7 @@
  266.    charset_initialise();
  267.  
  268.    DEBUGLEVEL = 0;
  269. -  dbf = fopen("/dev/null","w");
  270. +  dbf = fopen(NULL_DEVICE,"w");
  271.  
  272.    if (getuid() != geteuid()) {
  273.      printf("smbstatus should not be run setuid\n");
  274. diff -u orig-source/system.c source/system.c
  275. --- orig-source/system.c    Mon Jan 15 15:12:04 1996
  276. +++ source/system.c    Sun Feb 25 17:20:28 1996
  277. @@ -20,7 +20,9 @@
  278.  */
  279.  
  280.  #include "includes.h"
  281. +extern int DEBUGLEVEL ;
  282.  
  283. +
  284.  /*
  285.     The idea is that this file will eventually have wrappers around all
  286.     important system calls in samba. The aim is twofold:
  287. @@ -81,7 +83,7 @@
  288.      return(found);
  289.        }
  290.        
  291. -      if (tval && tval.tv_sec < counter) return(0);
  292. +      if (tval && tval->tv_sec < counter) return(0);
  293.        sleep(1);
  294.        counter++;
  295.      }
  296. @@ -99,6 +101,13 @@
  297.      selrtn = select(FD_SETSIZE,SELECT_CAST fds,NULL,NULL,tval?&t2:NULL);
  298.    } while (selrtn<0 && errno == EINTR);
  299.  
  300. +#ifdef BUGGY_OS2_SELECT
  301. +  if ( selrtn == 0 ) {
  302. +    /* EMX select() does not reset fds */
  303. +    FD_ZERO( fds ) ;
  304. +  }
  305. +#endif
  306. +
  307.    return(selrtn);
  308.  }
  309.  #endif
  310. @@ -171,7 +180,11 @@
  311.  ********************************************************************/
  312.  int sys_chdir(char *dname)
  313.  {
  314. +#if defined(HAVE_DRIVE_LETTERS)
  315. +  return(_chdir2(dos_to_unix(dname,False)));
  316. +#else
  317.    return(chdir(dos_to_unix(dname,False)));
  318. +#endif
  319.  }
  320.  
  321.  
  322. diff -u orig-source/util.c source/util.c
  323. --- orig-source/util.c    Tue Jan 16 12:14:44 1996
  324. +++ source/util.c    Mon Feb 26 09:44:52 1996
  325. @@ -2030,8 +2030,8 @@
  326.    /* try and use up these file descriptors, so silly
  327.       library routines writing to stdout etc won't cause havoc */
  328.    for (i=0;i<3;i++) {
  329. -    fd = open("/dev/null",O_RDWR,0);
  330. -    if (fd < 0) fd = open("/dev/null",O_WRONLY,0);
  331. +    fd = open(NULL_DEVICE,O_RDWR,0);
  332. +    if (fd < 0) fd = open(NULL_DEVICE,O_WRONLY,0);
  333.      if (fd < 0) {
  334.        DEBUG(0,("Can't open /dev/null\n"));
  335.        return;
  336. @@ -3975,7 +3975,9 @@
  337.  {
  338.    int ret;
  339.    pstring syscmd;  
  340. -
  341. +#ifdef NO_SMBRUN
  342. +  sprintf(syscmd,"%s >%s 2>&1", cmd, outfile?outfile:NULL_DEVICE) ;
  343. +#else
  344.    if (!file_exist(smbrun_path,NULL))
  345.      {
  346.        DEBUG(0,("SMBRUN ERROR: Can't find %s. Installation problem?\n",smbrun_path));
  347. @@ -3984,9 +3986,10 @@
  348.  
  349.    sprintf(syscmd,"%s \"(%s 2>&1) > %s\"",
  350.        smbrun_path,cmd,
  351. -      outfile?outfile:"/dev/null");
  352. +      outfile?outfile:NULL_DEVICE);
  353.  
  354.    DEBUG(5,("smbrun - running %s ",syscmd));
  355. +#endif
  356.    ret = system(syscmd);
  357.    DEBUG(5,("gave %d\n",ret));
  358.    return(ret);
  359.