From 17590be23d342259578d87c3d9310824863a5137 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 19 Nov 1998 22:37:33 +0000 Subject: Sync up with 2.0 code. Added HPUX autoconf changes. Added "gross hack" printer code. Jeremy. (This used to be commit 1ef6d3bd63722afe9c376793a6ea72046d1a0602) --- source3/smbd/ipc.c | 20 +++++++++++++ source3/smbd/nttrans.c | 80 +++++++++++++++++++++++++++++++++++++++++++++----- source3/smbd/trans2.c | 3 +- 3 files changed, 94 insertions(+), 9 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index d5ff7ddf28..41892504ad 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -842,6 +842,26 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, if (init_package(&desc,1,count)) { desc.subcount = count; fill_printq_info(conn,snum,uLevel,&desc,count,queue,&status); + } else if(uLevel == 0) { + /* + * This is a *disgusting* hack. + * This is *so* bad that even I'm embarrassed (and I + * have no shame). Here's the deal : + * Until we get the correct SPOOLSS code into smbd + * then when we're running with NT SMB support then + * NT makes this call with a level of zero, and then + * immediately follows it with an open request to + * the \\SRVSVC pipe. If we allow that open to + * succeed then NT barfs when it cannot open the + * \\SPOOLSS pipe immediately after and continually + * whines saying "Printer name is invalid" forever + * after. If we cause *JUST THIS NEXT OPEN* of \\SRVSVC + * to fail, then NT downgrades to using the downlevel code + * and everything works as well as before. I hate + * myself for adding this code.... JRA. + */ + + fail_next_srvsvc_open(); } *rdata_len = desc.usedlen; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index e4f0d2e2ec..c1c82b48e3 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -433,6 +433,38 @@ to open_mode %x\n", (unsigned long)desired_access, (unsigned long)share_access, return smb_open_mode; } +/* + * This is a *disgusting* hack. + * This is *so* bad that even I'm embarrassed (and I + * have no shame). Here's the deal : + * Until we get the correct SPOOLSS code into smbd + * then when we're running with NT SMB support then + * NT makes this call with a level of zero, and then + * immediately follows it with an open request to + * the \\SRVSVC pipe. If we allow that open to + * succeed then NT barfs when it cannot open the + * \\SPOOLSS pipe immediately after and continually + * whines saying "Printer name is invalid" forever + * after. If we cause *JUST THIS NEXT OPEN* of \\SRVSVC + * to fail, then NT downgrades to using the downlevel code + * and everything works as well as before. I hate + * myself for adding this code.... JRA. + * + * The HACK_FAIL_TIME define allows only a 2 + * second window for this to occur, just in + * case... + */ + +static BOOL fail_next_srvsvc = False; +static time_t fail_time; +#define HACK_FAIL_TIME 2 /* In seconds. */ + +void fail_next_srvsvc_open(void) +{ + fail_next_srvsvc = True; + fail_time = time(NULL); +} + /**************************************************************************** Reply to an NT create and X call on a pipe. ****************************************************************************/ @@ -451,6 +483,24 @@ static int nt_open_pipe(char *fname, connection_struct *conn, if( strequal(fname,known_nt_pipes[i])) break; + /* + * HACK alert.... see above - JRA. + */ + + if(fail_next_srvsvc && (time(NULL) > fail_time + HACK_FAIL_TIME)) { + fail_next_srvsvc = False; + fail_time = (time_t)0; + } + + if(fail_next_srvsvc && strequal(fname, "\\srvsvc")) { + fail_next_srvsvc = False; + return(ERROR(ERRSRV,ERRaccess)); + } + + /* + * End hack alert.... see above - JRA. + */ + if ( known_nt_pipes[i] == NULL ) return(ERROR(ERRSRV,ERRaccess)); @@ -562,8 +612,8 @@ int reply_ntcreate_and_X(connection_struct *conn, /* If it's an IPC, use the pipe handler. */ - if (IS_IPC(conn) && lp_nt_pipe_support() && lp_security() != SEC_SHARE) - { + if (IS_IPC(conn) && lp_nt_pipe_support()) { + int ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum); if(ret != 0) return ret; @@ -1393,7 +1443,13 @@ static int call_nt_transact_query_security_desc(connection_struct *conn, int bufsize, char **ppsetup, char **ppparams, char **ppdata) { - DEBUG(0,("call_nt_transact_query_security_desc: Currently not implemented.\n")); + static BOOL logged_message = False; + + if(!logged_message) { + DEBUG(0,("call_nt_transact_query_security_desc: Currently not implemented.\n")); + logged_message = True; /* Only print this once... */ + } + return(ERROR(ERRSRV,ERRnosupport)); } @@ -1408,8 +1464,13 @@ static int call_nt_transact_set_security_desc(connection_struct *conn, char **ppsetup, char **ppparams, char **ppdata) { - DEBUG(0,("call_nt_transact_set_security_desc: Currently not implemented.\n")); - return(ERROR(ERRSRV,ERRnosupport)); + static BOOL logged_message = False; + + if(!logged_message) { + DEBUG(0,("call_nt_transact_set_security_desc: Currently not implemented.\n")); + logged_message = True; /* Only print this once... */ + } + return(ERROR(ERRSRV,ERRnosupport)); } /**************************************************************************** @@ -1420,8 +1481,13 @@ static int call_nt_transact_ioctl(connection_struct *conn, int bufsize, char **ppsetup, char **ppparams, char **ppdata) { - DEBUG(0,("call_nt_transact_ioctl: Currently not implemented.\n")); - return(ERROR(ERRSRV,ERRnosupport)); + static BOOL logged_message = False; + + if(!logged_message) { + DEBUG(0,("call_nt_transact_ioctl: Currently not implemented.\n")); + logged_message = True; /* Only print this once... */ + } + return(ERROR(ERRSRV,ERRnosupport)); } /**************************************************************************** diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index db2be094b1..d71c23c87b 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1502,9 +1502,8 @@ static int call_trans2setfilepathinfo(connection_struct *conn, return(ERROR(ERRSRV,ERRaccess)); if (tran_call == TRANSACT2_SETFILEINFO) { - info_level = SVAL(params,2); - fsp = file_fsp(params,0); + info_level = SVAL(params,2); if(fsp && fsp->open && fsp->is_directory) { /* -- cgit