diff -u original-source/Makefile source/Makefile --- original-source/Makefile Thu Jul 24 20:50:18 1997 +++ source/Makefile Tue Aug 12 23:44:45 1997 @@ -576,17 +576,23 @@ # 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 # support for them is added to ixnet.library. # The binaries will have automatic stack extension :-) # smbd must be run from inetd :-( # 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 = ###################################################################### @@ -678,7 +684,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 source/client.c --- original-source/client.c Thu Jul 31 20:55:08 1997 +++ source/client.c Tue Aug 12 17:19:37 1997 @@ -326,7 +326,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 source/includes.h --- original-source/includes.h Thu Jul 24 20:50:22 1997 +++ source/includes.h Tue Aug 12 17:19:38 1997 @@ -949,6 +949,12 @@ #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); #define SIGNAL_CAST (void (*)(int)) #define USE_GETCWD @@ -1205,6 +1211,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 source/installscripts.sh --- original-source/installscripts.sh Fri Aug 16 15:10:48 1996 +++ source/installscripts.sh Tue Aug 12 23:42:58 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/local.h source/local.h --- original-source/local.h Fri Jul 18 22:44:46 1997 +++ source/local.h Tue Aug 12 17:19:38 1997 @@ -145,7 +145,7 @@ /* shall we support browse requests via a FIFO to nmbd? */ #define ENABLE_FIFO 1 -/* keep the password server open, this uses up a aocket, but is needed +/* keep the password server open, this uses up a socket, but is needed by many apps */ #define KEEP_PASSWORD_SERVER_OPEN 1 diff -u original-source/locking.c source/locking.c --- original-source/locking.c Fri Jul 18 22:44:46 1997 +++ source/locking.c Tue Aug 12 17:19:39 1997 @@ -637,6 +637,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", @@ -644,6 +645,7 @@ close(fd); return False; } +#endif *ptok = (share_lock_token)fd; return True; @@ -659,12 +661,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; diff -u original-source/message.c source/message.c --- original-source/message.c Thu May 8 18:35:38 1997 +++ source/message.c Tue Aug 12 17:19:42 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 strcpy(name,(char *)mktemp(s)); fd = open(name,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL,0600); diff -u original-source/params.c source/params.c --- original-source/params.c Thu May 8 18:35:40 1997 +++ source/params.c Tue Aug 12 17:19:42 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 source/password.c --- original-source/password.c Mon Jul 28 21:06:28 1997 +++ source/password.c Tue Aug 12 17:19:43 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 source/printing.c --- original-source/printing.c Thu May 8 18:35:40 1997 +++ source/printing.c Tue Aug 12 17:19:44 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 source/reply.c --- original-source/reply.c Thu Jul 24 20:50:32 1997 +++ source/reply.c Tue Aug 12 17:19:45 1997 @@ -483,7 +483,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); @@ -1988,11 +1996,11 @@ mtime = make_unix_date3(inbuf+smb_vwv1); + close_file(fnum); + /* try and set the date */ set_filetime(Files[fnum].name,mtime); - close_file(fnum); - /* We have a cached error */ if(eclass || err) return(ERROR(eclass,err)); @@ -2036,10 +2044,10 @@ nwritten = write_file(fnum,data,numtowrite); - set_filetime(Files[fnum].name,mtime); - close_file(fnum); + set_filetime(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 source/server.c --- original-source/server.c Mon Jul 28 21:06:31 1997 +++ source/server.c Tue Aug 12 17:19:47 1997 @@ -749,7 +749,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); @@ -4144,7 +4144,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 source/status.c --- original-source/status.c Fri Jul 18 22:44:53 1997 +++ source/status.c Tue Aug 12 17:19:48 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 source/uid.c --- original-source/uid.c Fri Jul 18 22:44:57 1997 +++ source/uid.c Tue Aug 12 17:19:49 1997 @@ -439,10 +439,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); @@ -460,8 +460,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 */ } @@ -472,7 +472,7 @@ execl("/bin/sh","sh","-c",cmd,NULL); /* not reached */ - exit(82); + _exit(82); #endif return 1; } diff -u original-source/util.c source/util.c --- original-source/util.c Thu Jul 31 20:55:24 1997 +++ source/util.c Tue Aug 12 17:19:51 1997 @@ -281,7 +281,11 @@ if ((p = getenv("TMPDIR"))) { return p; } +#ifndef AMIGA return "/tmp"; +#else + return "T:"; +#endif } @@ -3324,6 +3328,7 @@ sprintf(s,"/proc/%d",pid); return(directory_exist(s,NULL)); #else +#ifndef HAS_NO_PROC { static BOOL tested=False; static BOOL ok=False; @@ -3338,6 +3343,7 @@ return(file_exist(s,NULL)); } } +#endif /* CGH 8/16/96 - added ESRCH test */ return(pid == getpid() || kill(pid,0) == 0 || errno != ESRCH);