diff options
author | Luke Leighton <lkcl@samba.org> | 1997-11-09 17:30:10 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1997-11-09 17:30:10 +0000 |
commit | e357d9106895b165bfa3f8331b9f186004c9a6cd (patch) | |
tree | 52e18b1e8f0770f89d157c6766745ed201df11a6 /source3/smbd/server.c | |
parent | a81dd62af0321e0c78f81ea79605dade3e563f7a (diff) | |
download | samba-e357d9106895b165bfa3f8331b9f186004c9a6cd.tar.gz samba-e357d9106895b165bfa3f8331b9f186004c9a6cd.tar.bz2 samba-e357d9106895b165bfa3f8331b9f186004c9a6cd.zip |
attempting to mark up 32 bit error codes, needed for NT domains.
separated out smb server-mode password validation into a separate file.
added called and calling netbios names to client gen state: referenced
section in rfc1002.txt.
created workstation trust account checking code in ntclient.c
there might be a bug in reply_session_setup_andX. i indented and added { }
around single-line if statements: the lm password checking code now doesn't
look right (around the GUEST_SESSSETUP bits). *no code semantics have been
changed by the indentation process*.
(This used to be commit f27966957fa7f16d337a4a58719239d036deab4c)
Diffstat (limited to 'source3/smbd/server.c')
-rw-r--r-- | source3/smbd/server.c | 93 |
1 files changed, 57 insertions, 36 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 908cf984b8..a42b4deea2 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -25,6 +25,7 @@ pstring servicesf = CONFIGFILE; extern pstring debugf; extern pstring sesssetup_user; +extern pstring local_machine; extern fstring myworkgroup; char *InBuffer = NULL; @@ -114,6 +115,21 @@ static int find_free_connection(int hash); #define IS_DOS_SYSTEM(test_mode) (((test_mode) & aSYSTEM) != 0) #define IS_DOS_HIDDEN(test_mode) (((test_mode) & aHIDDEN) != 0) +/* use this to validate user against a password server. "security = server" */ +static struct cli_state pwd_srv; + +/**************************************************************************** + for use in reply.c, to access the password server connection. +****************************************************************************/ +struct cli_state *pwd_server_connection(void) +{ + if (pwd_srv.initialised) + { + return &pwd_srv; + } + return NULL; +} + /**************************************************************************** when exiting, take the whole family ****************************************************************************/ @@ -2257,21 +2273,30 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int { int outsize = set_message(outbuf,0,0,True); int cmd; - cmd = CVAL(inbuf,smb_com); - - CVAL(outbuf,smb_rcls) = error_class; - SSVAL(outbuf,smb_err,error_code); + int flgs2; + cmd = CVAL(inbuf,smb_com); + flgs2 = SVAL(outbuf,smb_flg2); - DEBUG(3,("%s error packet at line %d cmd=%d (%s) eclass=%d ecode=%d\n", - timestring(), - line, - (int)CVAL(inbuf,smb_com), - smb_fn_name(CVAL(inbuf,smb_com)), - error_class, - error_code)); + if ((flgs2 & FLAGS2_32_BIT_ERROR_CODES) == FLAGS2_32_BIT_ERROR_CODES) + { + SIVAL(outbuf,smb_rcls,error_code); + + DEBUG(3,("%s 32 bit error packet at line %d cmd=%d (%s) eclass=%08x [%s]\n", + timestring(), line, cmd, smb_fn_name(cmd), error_code, smb_errstr(outbuf))); + } + else + { + CVAL(outbuf,smb_rcls) = error_class; + SSVAL(outbuf,smb_err,error_code); + DEBUG(3,("%s error packet at line %d cmd=%d (%s) eclass=%d ecode=%d\n", + timestring(), line, cmd, smb_fn_name(cmd), error_class, error_code)); + } + if (errno != 0) - DEBUG(3,("error string = %s\n",strerror(errno))); + { + DEBUG(3,("error string = %s\n", strerror(errno))); + } return(outsize); } @@ -2328,12 +2353,13 @@ static int sig_cld() **************************************************************************/ static int sig_pipe() { - struct cli_state *cli; BlockSignals(True,SIGPIPE); - if ((cli = server_client()) && cli->initialised) { + if (pwd_srv.initialised) + { DEBUG(3,("lost connection to password server\n")); - cli_shutdown(cli); + cli_shutdown(&pwd_srv); + #ifndef DONT_REINSTALL_SIG signal(SIGPIPE, SIGNAL_CAST sig_pipe); #endif @@ -3684,29 +3710,27 @@ int reply_lanman2(char *outbuf) int secword=0; BOOL doencrypt = SMBENCRYPT(); time_t t = time(NULL); - struct cli_state *cli = NULL; char cryptkey[8]; char crypt_len = 0; - if (lp_security() == SEC_SERVER) { - cli = server_cryptkey(); - } - - if (cli) { + if (lp_security() == SEC_SERVER && server_cryptkey(&pwd_srv, local_machine)) + { DEBUG(3,("using password server validation\n")); - doencrypt = ((cli->sec_mode & 2) != 0); + doencrypt = ((pwd_srv.sec_mode & 2) != 0); } if (lp_security()>=SEC_USER) secword |= 1; if (doencrypt) secword |= 2; - if (doencrypt) { + if (doencrypt) + { crypt_len = 8; - if (!cli) { + if (pwd_srv.initialised) + { generate_next_challenge(cryptkey); } else { - memcpy(cryptkey, cli->cryptkey, 8); - set_challenge(cli->cryptkey); + memcpy(cryptkey, pwd_srv.cryptkey, 8); + set_challenge(pwd_srv.cryptkey); } } @@ -3751,16 +3775,14 @@ int reply_nt1(char *outbuf) char cryptkey[8]; char crypt_len = 0; - if (lp_security() == SEC_SERVER) { - cli = server_cryptkey(); - } - - if (cli) { + if (lp_security() == SEC_SERVER && server_cryptkey(&pwd_srv, local_machine)) + { DEBUG(3,("using password server validation\n")); - doencrypt = ((cli->sec_mode & 2) != 0); + doencrypt = ((pwd_srv.sec_mode & 2) != 0); } - if (doencrypt) { + if (doencrypt) + { crypt_len = 8; if (!cli) { generate_next_challenge(cryptkey); @@ -4862,15 +4884,14 @@ static void process(void) if (keepalive && (counter-last_keepalive)>keepalive) { - struct cli_state *cli = server_client(); if (!send_keepalive(Client)) { DEBUG(2,("%s Keepalive failed - exiting\n",timestring())); return; } /* also send a keepalive to the password server if its still connected */ - if (cli && cli->initialised) - send_keepalive(cli->fd); + if (pwd_srv.initialised) + send_keepalive(pwd_srv.fd); last_keepalive = counter; } |