From 396311075cc808278e6dd8469e3ac7eb7e7498c7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 13 Aug 1996 08:57:55 +0000 Subject: - sequent-ptx support from bressler@iftccu.ca.boeing.com (Rick Bressler) - machten support from Trevor Strohman (trev@figment.tenon.com) - added qinfo command to client as part of drag-and-drop printer support for win95 from David Chappell He also added the "printer driver" option - use sigblock() on more systems and use sigsetmask(0) instead of sigunblock() as its more portable. This beats a problem with zombies on heavilily loaded systems. - added internals.doc written by David Chappell into the source tree - get rid of PRINT_COMMAND options from local.h as they are no longer relevent - new kanji code from Fujita - don't set the recursion_available flag on queries in nmbd - fix a potential bug with pointer subtraction in printing.c - got rid of error_count code as the real fix (the EOF problem) is now in (This used to be commit aa6f8b04d125b5bc00f267abf72b800228aabf7d) --- source3/smbd/ipc.c | 16 +++++++-------- source3/smbd/mangle.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ source3/smbd/server.c | 23 +--------------------- 3 files changed, 63 insertions(+), 30 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index f4f1807922..0a54936cd0 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -190,12 +190,6 @@ static void send_trans_reply(char *outbuf,char *data,char *param,uint16 *setup, } } - - -/**************************************************************************** - get a print queue - ****************************************************************************/ - struct pack_desc { char* format; /* formatstring for structure */ char* subformat; /* subformat for structure */ @@ -419,6 +413,11 @@ static void PACKS(struct pack_desc* desc,char *t,char *v) PACK(desc,t,v); } + +/**************************************************************************** + get a print queue + ****************************************************************************/ + static void PackDriverData(struct pack_desc* desc) { char drivdata[4+4+32]; @@ -546,7 +545,7 @@ static void fill_printq_info(int cnum, int snum, int uLevel, PACKI(desc,"W",0); /* uUntiltime */ PACKI(desc,"W",5); /* pad1 */ PACKS(desc,"z",""); /* pszSepFile */ - PACKS(desc,"z","lpd"); /* pszPrProc */ + PACKS(desc,"z","WinPrint"); /* pszPrProc */ PACKS(desc,"z",""); /* pszParms */ if (!status || !status->message[0]) { PACKS(desc,"z",Expand(cnum,snum,lp_comment(snum))); /* pszComment */ @@ -557,7 +556,7 @@ static void fill_printq_info(int cnum, int snum, int uLevel, } PACKI(desc,(uLevel == 3 ? "W" : "N"),count); /* cJobs */ PACKS(desc,"z",SERVICE(snum)); /* pszPrinters */ - PACKS(desc,"z","NULL"); /* pszDriverName */ + PACKS(desc,"z",lp_printerdriver(snum)); /* pszDriverName */ PackDriverData(desc); /* pDriverData */ } if (uLevel == 2 || uLevel == 4) { @@ -594,6 +593,7 @@ static BOOL api_DosPrintQGetInfo(int cnum,int uid, char *param,char *data, cbBuf = SVAL(p,2); str3 = p + 4; + /* remove any trailing username */ if ((p = strchr(QueueName,'%'))) *p = 0; DEBUG(3,("PrintQueue uLevel=%d name=%s\n",uLevel,QueueName)); diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index cf1ece558c..177a34c975 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -509,9 +509,36 @@ void mangle_name_83(char *s) *p++ = 0; while (*p && extlen < 3) { +#ifdef KANJI + if (is_shift_jis (*p)) + { + if (extlen < 2) + { + extension[extlen++] = p[0]; + extension[extlen++] = p[1]; + } + else + { + extension[extlen++] = base36 (((unsigned char) *p) % 36); + } + p += 2; + } + else if (is_kana (*p)) + { + extension[extlen++] = p[0]; + p++; + } + else + { + if (isdoschar (*p) && *p != '.') + extension[extlen++] = p[0]; + p++; + } +#else if (isdoschar(*p) && *p != '.') extension[extlen++] = *p; p++; +#endif /* KANJI */ } extension[extlen] = 0; } @@ -521,9 +548,36 @@ void mangle_name_83(char *s) while (*p && baselen < 5) { +#ifdef KANJI + if (is_shift_jis (*p)) + { + if (baselen < 4) + { + base[baselen++] = p[0]; + base[baselen++] = p[1]; + } + else + { + base[baselen++] = base36 (((unsigned char) *p) % 36); + } + p += 2; + } + else if (is_kana (*p)) + { + base[baselen++] = p[0]; + p++; + } + else + { + if (isdoschar (*p) && *p != '.') + base[baselen++] = p[0]; + p++; + } +#else if (isdoschar(*p) && *p != '.') base[baselen++] = *p; p++; +#endif /* KANJI */ } base[baselen] = 0; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index d15ca9336e..334edf77d0 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -230,7 +230,7 @@ int dos_chmod(int cnum,char *fname,int dosmode,struct stat *st) unixmode |= tmp; } - return(chmod(fname,unixmode)); + return(sys_chmod(fname,unixmode)); } @@ -3443,27 +3443,6 @@ static void process(void) t = time(NULL); - { - /* the following bit of code was added to combat smbd - looping chewing lots of CPU time. It should never - actually be needed, but it seems that some systems - don't set error correctly, which is used to distinguish - a select() timeout from a read error - - we exit if receive_smb() returns false 3 times in one second. - */ - static int error_count=0; - static time_t error_time=0; - if (error_count++==0) { - error_time = t; - } else if (error_time != t) { - error_count = 0; - } else if (error_count > 2) { - exit_server("looping in process()\n"); - } - } - - /* become root again if waiting */ unbecome_user(); -- cgit