summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-12-03 20:53:48 +0000
committerJeremy Allison <jra@samba.org>1998-12-03 20:53:48 +0000
commit469f99d9c3ae5a3dca105ccee86c1ce7d17cae4d (patch)
tree851812e9eefb11445ff3ee61e9ea077347eb393b
parenta821674274b84bd73c6de053a70b8e09a5cd2f0a (diff)
downloadsamba-469f99d9c3ae5a3dca105ccee86c1ce7d17cae4d.tar.gz
samba-469f99d9c3ae5a3dca105ccee86c1ce7d17cae4d.tar.xz
samba-469f99d9c3ae5a3dca105ccee86c1ce7d17cae4d.zip
config.guess: UNIXWARE fix.
lib/util.c: Debug messages for getrlim/setrlim calls. libsmb/clientgen.c: Added session redirect code back in. smbd/nttrans.c smbd/pipes.c: Correct fix for NT printer problem - catches openX as well as nttrans open. Jeremy.
-rwxr-xr-xsource/config.guess3
-rw-r--r--source/include/proto.h1
-rw-r--r--source/lib/util.c24
-rw-r--r--source/libsmb/clientgen.c31
-rw-r--r--source/smbd/nttrans.c48
-rw-r--r--source/smbd/pipes.c6
6 files changed, 89 insertions, 24 deletions
diff --git a/source/config.guess b/source/config.guess
index 2b6b1e6268c..9b53cb62ee1 100755
--- a/source/config.guess
+++ b/source/config.guess
@@ -425,6 +425,9 @@ EOF
echo ${UNAME_MACHINE}-unknown-sysv32
fi
exit 0 ;;
+ *:UnixWare:*:*)
+ echo ${UNAME_MACHINE}-UnixWare-sysv${UNAME_RELEASE}
+ exit 0 ;;
Intel:Mach:3*:*)
echo i386-unknown-mach3
exit 0 ;;
diff --git a/source/include/proto.h b/source/include/proto.h
index d69f715f0ec..08f8237a101 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -2407,6 +2407,7 @@ BOOL disk_quotas(char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT
/*The following definitions come from smbd/nttrans.c */
void fail_next_srvsvc_open(void);
+BOOL should_fail_next_srvsvc_open(const char *pipename);
int reply_ntcreate_and_X(connection_struct *conn,
char *inbuf,char *outbuf,int length,int bufsize);
int reply_ntcancel(connection_struct *conn,
diff --git a/source/lib/util.c b/source/lib/util.c
index b4ee318570c..f5c609cafcd 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -2865,14 +2865,32 @@ int set_maxfiles(int requested_max)
{
#if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
struct rlimit rlp;
- getrlimit(RLIMIT_NOFILE, &rlp);
+ if(getrlimit(RLIMIT_NOFILE, &rlp)) {
+ DEBUG(0,("set_maxfiles: getrlimit (1) for RLIMIT_NOFILE failed with error %s\n",
+ strerror(errno) ));
+ /* just guess... */
+ return requested_max;
+ }
/* Set the fd limit to be real_max_open_files + MAX_OPEN_FUDGEFACTOR to
* account for the extra fd we need
* as well as the log files and standard
* handles etc. */
rlp.rlim_cur = MIN(requested_max,rlp.rlim_max);
- setrlimit(RLIMIT_NOFILE, &rlp);
- getrlimit(RLIMIT_NOFILE, &rlp);
+
+ if(setrlimit(RLIMIT_NOFILE, &rlp)) {
+ DEBUG(0,("set_maxfiles: setrlimit for RLIMIT_NOFILE for %d files failed with error %s\n",
+ (int)rlp.rlim_cur, strerror(errno) ));
+ /* just guess... */
+ return requested_max;
+ }
+
+ if(getrlimit(RLIMIT_NOFILE, &rlp)) {
+ DEBUG(0,("set_maxfiles: getrlimit (2) for RLIMIT_NOFILE failed with error %s\n",
+ strerror(errno) ));
+ /* just guess... */
+ return requested_max;
+ }
+
return rlp.rlim_cur;
#else
/*
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index c9d221bd337..3e8932d51f9 100644
--- a/source/libsmb/clientgen.c
+++ b/source/libsmb/clientgen.c
@@ -26,7 +26,7 @@
extern int DEBUGLEVEL;
-
+extern pstring user_socket_options;
/****************************************************************************
recv an smb
@@ -2312,6 +2312,35 @@ retry:
if (!cli_receive_smb(cli))
return False;
+ if (CVAL(cli->inbuf,0) == 0x84) {
+ /* C. Hoch 9/14/95 Start */
+ /* For information, here is the response structure.
+ * We do the byte-twiddling to for portability.
+ struct RetargetResponse{
+ unsigned char type;
+ unsigned char flags;
+ int16 length;
+ int32 ip_addr;
+ int16 port;
+ };
+ */
+ int port = (CVAL(cli->inbuf,8)<<8)+CVAL(cli->inbuf,9);
+ /* SESSION RETARGET */
+ putip((char *)&cli->dest_ip,cli->inbuf+4);
+
+ close_sockets();
+ cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip, port, LONG_CONNECT_TIMEOUT);
+ if (cli->fd == -1)
+ return False;
+
+ DEBUG(3,("Retargeted\n"));
+
+ set_socket_options(cli->fd,user_socket_options);
+
+ /* Try again */
+ return cli_session_request(cli, calling, called);
+ } /* C. Hoch 9/14/95 End */
+
#ifdef WITH_SSL
if (CVAL(cli->inbuf,0) == 0x83 && CVAL(cli->inbuf,4) == 0x8e){ /* use ssl */
if (!sslutil_fd_is_ssl(cli->fd)){
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index 8aacfa38677..a97fef518bc 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -466,6 +466,31 @@ void fail_next_srvsvc_open(void)
DEBUG(10,("fail_next_srvsvc_open: setting up timeout close of \\srvsvc pipe for print fix.\n"));
}
+/*
+ * HACK alert.... see above - JRA.
+ */
+
+BOOL should_fail_next_srvsvc_open(const char *pipename)
+{
+
+ DEBUG(10,("should_fail_next_srvsvc_open: fail = %d, pipe = %s\n",
+ (int)fail_next_srvsvc, pipename));
+
+ if(fail_next_srvsvc && (time(NULL) > fail_time + HACK_FAIL_TIME)) {
+ fail_next_srvsvc = False;
+ fail_time = (time_t)0;
+ DEBUG(10,("should_fail_next_srvsvc_open: End of timeout close of \\srvsvc pipe for print fix.\n"));
+ }
+
+ if(fail_next_srvsvc && strequal(pipename, "srvsvc")) {
+ fail_next_srvsvc = False;
+ DEBUG(10,("should_fail_next_srvsvc_open: Deliberately failing open of \\srvsvc pipe for print fix.\n"));
+ return True;
+ }
+ return False;
+}
+
+
/****************************************************************************
Reply to an NT create and X call on a pipe.
****************************************************************************/
@@ -484,32 +509,15 @@ 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;
- DEBUG(10,("nt_open_pipe: End of timeout close of \\srvsvc pipe for print fix.\n"));
- }
-
- if(fail_next_srvsvc && strequal(fname, "\\srvsvc")) {
- fail_next_srvsvc = False;
- DEBUG(10,("nt_open_pipe: Deliberately failing open of \\srvsvc pipe for print fix.\n"));
- return(ERROR(ERRSRV,ERRaccess));
- }
-
- /*
- * End hack alert.... see above - JRA.
- */
-
if ( known_nt_pipes[i] == NULL )
return(ERROR(ERRSRV,ERRaccess));
/* Strip \\ off the name. */
fname++;
+ if(should_fail_next_srvsvc_open(fname))
+ return (ERROR(ERRSRV,ERRaccess));
+
DEBUG(3,("nt_open_pipe: Known pipe %s opening.\n", fname));
p = open_rpc_pipe_p(fname, conn, vuid);
diff --git a/source/smbd/pipes.c b/source/smbd/pipes.c
index 374aa70d0f2..b3bafea329e 100644
--- a/source/smbd/pipes.c
+++ b/source/smbd/pipes.c
@@ -74,6 +74,12 @@ int reply_open_pipe_and_X(connection_struct *conn,
/* Strip \PIPE\ off the name. */
pstrcpy(fname,smb_buf(inbuf) + PIPELEN);
+ /*
+ * Hack for NT printers... JRA.
+ */
+ if(should_fail_next_srvsvc_open(fname))
+ return(ERROR(ERRSRV,ERRaccess));
+
/* Known pipes arrive with DIR attribs. Remove it so a regular file */
/* can be opened and add it in after the open. */
DEBUG(3,("Known pipe %s opening.\n",fname));