diff -u ../original-source/Makefile ./Makefile --- ../original-source/Makefile Tue Oct 21 12:47:16 1997 +++ ./Makefile Sun Nov 23 03:59:27 1997 @@ -586,8 +586,8 @@ # LIBSM = -linet -# This for Amiga using GCC and ixemul.library 43.0 or later. -# contributed by Rask Ingemann Lambertsen +# This is for Amiga using GCC and ixemul.library 43.0 or later. +# contributed by Rask Ingemann Lambertsen # The binaries will support both AmiTCP and AS225R2 compatible # protocol stacks because of the use of ixnet.library. # Other protocol stacks will be supported automatically if @@ -597,6 +597,12 @@ # FLAGSM = -DAMIGA -Dfork=vfork -mstackextend # LIBSM = +# Same as above, except it uses mmap() and requires +# ixemul.library 46.0+ or so. To get Samba to actually take advantage +# of mmap(), put "read raw = no" and "read prediction = no" into +# smb.conf. +# FLAGSM = -DAMIGA -Dfork=vfork -mstackextend -DUSE_MMAP +# LIBSM = ###################################################################### @@ -688,7 +694,7 @@ @$(SHELL) $(srcdir)installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS) installscripts: - @$(SHELL) $(srcdir)installscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS) + @$(SHELL) $(srcdir)installscripts.sh $(INSTALLPERMS) $(BINDIR) "$(srcdir)" $(SCRIPTS) # revert to the previously installed version revert: diff -u ../original-source/client.c ./client.c --- ../original-source/client.c Tue Oct 21 12:47:16 1997 +++ ./client.c Tue Nov 25 23:27:43 1997 @@ -328,7 +328,11 @@ grp_id = SVAL(inbuf,smb_vwv0); +#ifdef AMIGA + printf("Connected. Type your message, ending it with a Control-\\\n"); +#else printf("Connected. Type your message, ending it with a Control-D\n"); +#endif while (!feof(stdin) && total_len < 1600) { diff -u ../original-source/includes.h ./includes.h --- ../original-source/includes.h Tue Oct 7 13:18:26 1997 +++ ./includes.h Tue Nov 25 23:35:19 1997 @@ -965,6 +965,15 @@ #include #include #include +#include + +/* Prototype for ACrypt to avoid including header files which have + definitions which conflict with Un*x ones. + */ +char *ACrypt (char *buffer, char *password, char *username); + +/* Make smbclient use WINS name resolution. */ +#define USENMB #define SIGNAL_CAST (void (*)(int)) #define USE_GETCWD @@ -1225,6 +1234,7 @@ #define F_SETLK 0 #define F_WRLCK 0 #define F_UNLCK 0 +#define F_SETLKW 0 #endif /* HAVE_FCNTL_LOCK == 0 */ #ifdef NOSTRCASECMP diff -u ../original-source/installscripts.sh ./installscripts.sh --- ../original-source/installscripts.sh Fri Aug 16 15:09:59 1996 +++ ./installscripts.sh Sun Nov 23 04:00:05 1997 @@ -4,11 +4,17 @@ INSTALLPERMS=$1 BINDIR=$2 +SRCDIR=$3 shift shift +shift echo Installing scripts in $BINDIR + +if [ -n "$SRCDIR" ]; then + cd "$SRCDIR" +fi for d in $BINDIR; do if [ ! -d $d ]; then diff -u ../original-source/locking.c ./locking.c --- ../original-source/locking.c Mon Oct 20 18:05:02 1997 +++ ./locking.c Sun Dec 14 00:32:18 1997 @@ -673,6 +673,7 @@ /* At this point we have an open fd to the share mode file. Lock the first byte exclusively to signify a lock. */ +#if HAVE_FCNTL_LOCK if(fcntl_lock(fd, F_SETLKW, 0, 1, F_WRLCK) == False) { DEBUG(0,("ERROR lock_share_entry: fcntl_lock failed with %s\n", @@ -681,6 +682,7 @@ ret = False; break; } +#endif /* * If we cannot stat the filename, the file was deleted between @@ -743,12 +745,14 @@ /* token is the fd of the open share mode file. */ /* Unlock the first byte. */ +#if HAVE_FCNTL_LOCK if(fcntl_lock(fd, F_SETLKW, 0, 1, F_UNLCK) == False) { DEBUG(0,("ERROR unlock_share_entry: fcntl_lock failed with %s\n", strerror(errno))); ret = False; } +#endif close((int)token); return ret; @@ -995,6 +999,10 @@ free(buf); return 0; } + + /* This alwasy fails on the Amiga for some reason. Until the problem is + * solved, don't spam the log files. */ +#ifndef AMIGA /* Now truncate the file at this point. */ if(ftruncate(fd, newsize)!= 0) { @@ -1007,6 +1015,7 @@ free(buf); return 0; } +#endif } if(buf) @@ -1145,6 +1154,10 @@ free(buf); return; } + + /* This alwasy fails on the Amiga for some reason. Until the problem is + * solved, don't spam the log files. */ +#ifndef AMIGA /* Now truncate the file at this point. */ if(ftruncate(fd, newsize) != 0) { @@ -1154,6 +1167,7 @@ free(buf); return; } +#endif } /******************************************************************* @@ -1280,6 +1294,9 @@ return False; } + /* This alwasy fails on the Amiga for some reason. Until the problem is + * solved, don't spam the log files. */ +#ifndef AMIGA /* Now truncate the file at this point - just for safety. */ if(ftruncate(fd, header_size + (16*num_entries))!= 0) { @@ -1289,6 +1306,7 @@ free(buf); return False; } +#endif if(buf) free(buf); diff -u ../original-source/message.c ./message.c --- ../original-source/message.c Fri Sep 26 14:39:40 1997 +++ ./message.c Sun Nov 23 11:21:10 1997 @@ -53,7 +53,12 @@ } /* put it in a temporary file */ +#ifndef AMIGA sprintf(s,"%s/msg.XXXXXX",tmpdir()); +#else + strcpy (s, tmpdir ()); + AddPart (s, "msg.XXXXXX", 1024); +#endif fstrcpy(name,(char *)mktemp(s)); fd = open(name,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL,0600); diff -u ../original-source/params.c ./params.c --- ../original-source/params.c Thu May 8 03:13:57 1997 +++ ./params.c Sun Nov 23 04:00:19 1997 @@ -319,7 +319,7 @@ } if (!bRetval) - DEBUG(0,("pm_process retuned false\n")); + DEBUG(0,("pm_process returned false\n")); return (bRetval); } diff -u ../original-source/password.c ./password.c --- ../original-source/password.c Tue Oct 21 12:47:17 1997 +++ ./password.c Sun Nov 23 04:00:24 1997 @@ -708,6 +708,27 @@ #endif +#ifdef AMIGA +/**************************************************************************** +Do password checking in a MultiUser 2 and INET225 compatible way. +****************************************************************************/ +static int amiga_crypt(char *passwd, char *user, char *salt, char *crypted) +{ + char acrypt_buffer[12]; + + if (strcmp((char *) crypt(passwd, salt), this_crypted) == 0) + return (True); + else + { + if (ACrypt(passwd, user, acrypt_buffer) == 0UL) + return (False); + else + return (strcmp(acrypt_buffer, crypted) == 0); + } +} +#endif + + /**************************************************************************** apply a function to upper/lower case combinations of a string and return true if one of them returns true. @@ -802,6 +823,10 @@ #ifdef LINUX_BIGCRYPT return(linux_bigcrypt(password,this_salt,this_crypted)); +#endif + +#ifdef AMIGA + return (amiga_crypt(password, this_user, this_salt, this_crypted)); #endif #ifdef NO_CRYPT diff -u ../original-source/printing.c ./printing.c --- ../original-source/printing.c Fri Sep 26 14:39:43 1997 +++ ./printing.c Sun Nov 23 04:00:26 1997 @@ -945,7 +945,13 @@ standard_sub(cnum,syscmd); +#ifndef AMIGA sprintf(outfile,"%s/lpq.%08x",tmpdir(),str_checksum(syscmd)); +#else + strcpy (outfile, tmpdir ()); + AddPart (outfile, "lpq.", 128); + sprintf (outfile+strlen (outfile), "%08x", str_checksum (syscmd)); +#endif if (!lpq_cache_reset[snum] && cachetime && !stat(outfile,&sbuf)) { diff -u ../original-source/reply.c ./reply.c --- ../original-source/reply.c Tue Oct 21 12:47:18 1997 +++ ./reply.c Sun Nov 23 11:25:11 1997 @@ -571,7 +571,15 @@ char *p; set_message(outbuf,3,3,True); p = smb_buf(outbuf); +#ifdef OS2 + strcpy(p,"OS/2"); p = skip_string(p,1); +#else +#ifdef AMIGA + strcpy(p,"Amiga"); p = skip_string(p,1); +#else strcpy(p,"Unix"); p = skip_string(p,1); +#endif +#endif strcpy(p,"Samba "); strcat(p,VERSION); p = skip_string(p,1); strcpy(p,myworkgroup); p = skip_string(p,1); set_message(outbuf,3,PTR_DIFF(p,smb_buf(outbuf)),False); @@ -2194,11 +2202,11 @@ mtime = make_unix_date3(inbuf+smb_vwv1); + close_file(fnum, 1); + /* try and set the date */ set_filetime(cnum,Files[fnum].name,mtime); - close_file(fnum, 1); - /* We have a cached error */ if(eclass || err) return(ERROR(eclass,err)); @@ -2242,10 +2250,10 @@ nwritten = write_file(fnum,data,numtowrite); - set_filetime(cnum,Files[fnum].name,mtime); - close_file(fnum, 1); + set_filetime(cnum,Files[fnum].name,mtime); + DEBUG(3,("%s writeclose fnum=%d cnum=%d num=%d wrote=%d (numopen=%d)\n", timestring(),fnum,cnum,numtowrite,nwritten, Connections[cnum].num_files_open)); diff -u ../original-source/server.c ./server.c --- ../original-source/server.c Tue Oct 21 18:35:51 1997 +++ ./server.c Sun Nov 23 04:00:33 1997 @@ -839,7 +839,7 @@ *bsize = 512; #endif -/* handle rediculous bsize values - some OSes are broken */ +/* handle ridiculous bsize values - some OSes are broken */ if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024; disk_norm(bsize,dfree,dsize); @@ -4300,7 +4300,7 @@ charset_initialise(); - /* make absolutely sure we run as root - to handle cases whre people + /* make absolutely sure we run as root - to handle cases where people are crazy enough to have it setuid */ #ifdef USE_SETRES setresuid(0,0,0); diff -u ../original-source/status.c ./status.c --- ../original-source/status.c Fri Sep 5 23:49:07 1997 +++ ./status.c Sun Nov 23 04:00:34 1997 @@ -183,7 +183,7 @@ Ucrit_addUsername(optarg); /* added by OH */ break; default: - fprintf(stderr, "Usage: %s [-d] [-p] [-s configfile] [-u username]\n", *argv); /* changed by OH */ + fprintf(stderr, "Usage: %s [-b] [-d] [-p] [-s configfile] [-u username]\n", *argv); /* changed by OH */ return (-1); } } @@ -223,13 +223,23 @@ if (brief) { +#ifdef UNIX printf("PID Username Machine Time logged in\n"); printf("-------------------------------------------------------------------\n"); +#else + printf("PID Username Machine Time logged in\n"); + printf("------------------------------------------------------------------------\n"); +#endif } else { - printf("Service uid gid pid machine\n"); - printf("----------------------------------------------\n"); +#ifdef UNIX + printf("Service uid gid pid machine\n"); + printf("----------------------------------------------\n"); +#else + printf("Service uid gid pid machine\n"); + printf("---------------------------------------------------\n"); +#endif } } @@ -276,10 +286,17 @@ add a sort at some time */ } else +#ifdef UNIX printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s", crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid, crec.machine,crec.addr, asctime(LocalTime(&crec.start))); +#else + printf("%-10.10s %-8s %-8s %10d %-8s (%s) %s", + crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid, + crec.machine,crec.addr, + asctime(LocalTime(&crec.start))); +#endif } } } @@ -292,7 +309,11 @@ ptr=srecs; while (ptr!=NULL) { +#ifdef UNIX printf("%-8d%-10.10s%-30.30s%s",ptr->pid,uidtoname(ptr->uid),ptr->machine,asctime(LocalTime(&(ptr->start)))); +#else + printf("%-13d%-10.10s%-30.30s%s",ptr->pid,uidtoname(ptr->uid),ptr->machine,asctime(LocalTime(&(ptr->start)))); +#endif ptr=ptr->next; } printf("\n"); @@ -378,6 +399,7 @@ continue; } +#if HAVE_FCNTL_LOCK /* Lock the share mode file while we read it. */ if(fcntl_lock(fd, F_SETLKW, 0, 1, F_WRLCK) == False) { @@ -385,6 +407,7 @@ close(fd); continue; } +#endif if(( buf = read_share_file( fd, lname, argv[0] )) == NULL) { @@ -411,12 +434,21 @@ if (firstopen) { firstopen=False; printf("Locked files:\n"); +#ifdef UNIX printf("Pid DenyMode R/W Name\n"); printf("------------------------------\n"); +#else + printf("Pid DenyMode R/W Name\n"); + printf("-----------------------------------\n"); +#endif } +#ifdef UNIX printf("%-5d ",pid); +#else + printf("%-10d ",pid); +#endif switch ((mode>>4)&0xF) { case DENY_NONE: printf("DENY_NONE "); break; diff -u ../original-source/uid.c ./uid.c --- ../original-source/uid.c Tue Oct 21 18:35:51 1997 +++ ./uid.c Sun Nov 23 04:00:43 1997 @@ -442,10 +442,10 @@ /* point our stdout at the file we want output to go into */ if (outfile && !setup_stdout_file(outfile,shared)) { - exit(80); + _exit(80); } - /* now completely lose our privilages. This is a fairly paranoid + /* now completely lose our privileges. This is a fairly paranoid way of doing it, but it does work on all systems that I know of */ #ifdef USE_SETRES setresgid(0,0,0); @@ -463,8 +463,8 @@ if (getuid() != uid || geteuid() != uid || getgid() != gid || getegid() != gid) { - /* we failed to lose our privilages - do not execute the command */ - exit(81); /* we can't print stuff at this stage, instead use exit codes + /* we failed to lose our privileges - do not execute the command */ + _exit(81); /* we can't print stuff at this stage, instead use exit codes for debugging */ } @@ -475,7 +475,7 @@ execl("/bin/sh","sh","-c",cmd,NULL); /* not reached */ - exit(82); + _exit(82); #endif return 1; } diff -u ../original-source/util.c ./util.c --- ../original-source/util.c Wed Oct 15 00:16:21 1997 +++ ./util.c Sun Nov 23 04:00:46 1997 @@ -290,7 +290,11 @@ if ((p = getenv("TMPDIR"))) { return p; } +#ifndef AMIGA return "/tmp"; +#else + return "T:"; +#endif } @@ -3465,6 +3469,7 @@ sprintf(s,"/proc/%d",pid); return(directory_exist(s,NULL)); #else +#ifndef HAS_NO_PROC { static BOOL tested=False; static BOOL ok=False; @@ -3479,6 +3484,7 @@ return(file_exist(s,NULL)); } } +#endif /* CGH 8/16/96 - added ESRCH test */ return(pid == getpid() || kill(pid,0) == 0 || errno != ESRCH);