diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/client/client.c | 7 | ||||
-rw-r--r-- | source3/include/includes.h | 9 | ||||
-rw-r--r-- | source3/include/proto.h | 5 | ||||
-rw-r--r-- | source3/locking/locking.c | 8 | ||||
-rw-r--r-- | source3/locking/shmem.c | 5 | ||||
-rw-r--r-- | source3/namedbname.c | 73 | ||||
-rw-r--r-- | source3/smbd/server.c | 19 | ||||
-rw-r--r-- | source3/utils/status.c | 8 |
8 files changed, 68 insertions, 66 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index a6bb50cb3d..b0e4f4a004 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2523,7 +2523,7 @@ static void cmd_qinfo(char *inbuf,char *outbuf ) char *p; int rdrcnt, rprcnt; pstring param; - int result_code; + int result_code=0; bzero(param,sizeof(param)); @@ -3037,6 +3037,7 @@ static BOOL send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setu pstring dev; char *p; int numprots; + int tries=0; if (was_null) { @@ -3174,6 +3175,10 @@ static BOOL send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setu else pass = (char *)getpass("Password: "); + /* use a blank username for the 2nd try with a blank password */ + if (tries++ && !*pass) + *username = 0; + if (Protocol >= PROTOCOL_LANMAN1 && use_setup) { fstring pword; diff --git a/source3/include/includes.h b/source3/include/includes.h index 79400683fe..35ef18055c 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -183,10 +183,6 @@ #endif #endif -#if defined(USE_MMAP) || defined(FAST_SHARE_MODES) -#include <sys/mman.h> -#endif - #if defined(GETPWANAM) #include <sys/types.h> #include <sys/label.h> @@ -224,6 +220,7 @@ Here come some platform specific sections #define HAVE_BZERO #define HAVE_MEMMOVE #define USE_SIGPROCMASK +#define FAST_SHARE_MODES 1 #if 0 /* SETFS disabled until we can check on some bug reports */ #if _LINUX_C_LIB_VERSION_MAJOR >= 5 @@ -909,6 +906,10 @@ typedef int mode_t; end of the platform specific sections ********************************************************************/ +#if defined(USE_MMAP) || FAST_SHARE_MODES +#include <sys/mman.h> +#endif + #ifdef SecureWare #define NEED_AUTH_PARAMETERS #endif diff --git a/source3/include/proto.h b/source3/include/proto.h index 87ad286df3..c1697dc641 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -796,11 +796,6 @@ BOOL become_user(int cnum, int uid); BOOL unbecome_user(void ); int smbrun(char *cmd,char *outfile); -/*The following definitions come from unxlog.c */ - -void write_utmp(int dologin, int connection, int pid, - char *from_addr, char *username); - /*The following definitions come from username.c */ char *get_home_dir(char *user); diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 60428f2e98..966bb2253b 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -231,7 +231,7 @@ BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 * return True; /* Did unlock */ } -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES /******************************************************************* initialize the shared memory for share_mode management ******************************************************************/ @@ -312,7 +312,7 @@ get the share mode of a file ********************************************************************/ int get_share_mode(int cnum,struct stat *sbuf,int *pid) { -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES share_mode_record *scanner_p; share_mode_record *prev_p; int ret; @@ -434,7 +434,7 @@ del the share mode of a file, if we set it last ********************************************************************/ void del_share_mode(int fnum) { -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES struct stat st; time_t t=0; int pid=0; @@ -540,7 +540,7 @@ set the share mode of a file ********************************************************************/ BOOL set_share_mode(int fnum,int mode) { -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES int pid = (int)getpid(); struct stat st; shm_offset_t new_off; diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c index 3a308d07ba..f68059afa2 100644 --- a/source3/locking/shmem.c +++ b/source3/locking/shmem.c @@ -20,10 +20,11 @@ */ -#ifdef FAST_SHARE_MODES +#include "includes.h" -#include "includes.h" +#if FAST_SHARE_MODES + extern int DEBUGLEVEL; diff --git a/source3/namedbname.c b/source3/namedbname.c index b8edfa2554..188e46ff75 100644 --- a/source3/namedbname.c +++ b/source3/namedbname.c @@ -230,8 +230,8 @@ void dump_names(void) { int i; - DEBUG(3,("%15s ", inet_ntoa(d->bcast_ip))); - DEBUG(3,("%15s ", inet_ntoa(d->mask_ip))); + DEBUG(3,("%15s ", inet_ntoa(d->bcast_ip))); + DEBUG(3,("%15s ", inet_ntoa(d->mask_ip))); DEBUG(3,("%-19s TTL=%ld ", namestr(&n->name), n->death_time?n->death_time-t:0)); @@ -243,35 +243,29 @@ void dump_names(void) n->ip_flgs[i].nb_flags)); } - DEBUG(3,("\n")); + DEBUG(3,("\n")); if (f && ip_equal(d->bcast_ip, ipgrp) && n->source == REGISTER) { - fstring data; - /* XXXX i have little imagination as to how to output nb_flags as anything other than as a hexadecimal number :-) */ - sprintf(data, "%s#%02x %ld", - n->name.name,n->name.name_type, /* XXXX ignore scope for now */ - n->death_time); - fprintf(f, "%s", data); + fprintf(f,"%s#%02x %ld", + n->name.name,n->name.name_type, /* XXXX ignore scope for now */ + n->death_time); for (i = 0; i < n->num_ips; i++) { DEBUG(3,("%15s NB=%2x ", - inet_ntoa(n->ip_flgs[i].ip), - n->ip_flgs[i].nb_flags)); + inet_ntoa(n->ip_flgs[i].ip), + n->ip_flgs[i].nb_flags)); - sprintf(data, "%s %2x ", - inet_ntoa(n->ip_flgs[i].ip), - n->ip_flgs[i].nb_flags); - - fprintf(f, "%s", data); + fprintf(f, "%s %2x ", + inet_ntoa(n->ip_flgs[i].ip), + n->ip_flgs[i].nb_flags); } - DEBUG(3,("\n")); - fprintf(f, "\n"); + DEBUG(3,("\n")); + fprintf(f, "\n"); } - } fclose(f); @@ -318,34 +312,31 @@ void load_netbios_names(void) int type = 0; int nb_flags; time_t ttd; - struct in_addr ipaddr; - - enum name_source source; - + struct in_addr ipaddr; + enum name_source source; char *ptr; - int count = 0; - + int count = 0; char *p; if (!fgets_slash(line,sizeof(pstring),f)) continue; if (*line == '#') continue; - ptr = line; - - if (next_token(&ptr,name_str ,NULL)) ++count; - if (next_token(&ptr,ttd_str ,NULL)) ++count; - if (next_token(&ptr,ip_str ,NULL)) ++count; - if (next_token(&ptr,nb_flags_str,NULL)) ++count; + ptr = line; - if (count <= 0) continue; + if (next_token(&ptr,name_str ,NULL)) ++count; + if (next_token(&ptr,ttd_str ,NULL)) ++count; + if (next_token(&ptr,ip_str ,NULL)) ++count; + if (next_token(&ptr,nb_flags_str,NULL)) ++count; - if (count != 4) { - DEBUG(0,("Ill formed wins line")); - DEBUG(0,("[%s]: name#type ip nb_flags abs_time\n",line)); - continue; - } + if (count <= 0) continue; + if (count != 4) { + DEBUG(0,("Ill formed wins line")); + DEBUG(0,("[%s]: name#type ip nb_flags abs_time\n",line)); + continue; + } + /* netbios name. # divides the name from the type (hex): netbios#xx */ strcpy(name,name_str); @@ -357,10 +348,10 @@ void load_netbios_names(void) } /* decode the netbios flags (hex) and the time-to-die (seconds) */ - sscanf(nb_flags_str,"%x",&nb_flags); - sscanf(ttd_str,"%ld",&ttd); + sscanf(nb_flags_str,"%x",&nb_flags); + sscanf(ttd_str,"%ld",&ttd); - ipaddr = *interpret_addr2(ip_str); + ipaddr = *interpret_addr2(ip_str); if (ip_equal(ipaddr,ipzero)) { source = SELF; @@ -545,7 +536,7 @@ struct name_record *search_for_name(struct subnet_record **d, if (!n) { struct in_addr dns_ip; - unsigned long a; + uint32 a; /* only do DNS lookups if the query is for type 0x20 or type 0x0 */ if (!dns_type && name_type != 0x1b) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 3889440975..403b41e86b 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -3026,7 +3026,7 @@ struct smb_message_struct {SMBctemp,"SMBctemp",reply_ctemp,AS_USER}, {SMBsplopen,"SMBsplopen",reply_printopen,AS_USER}, {SMBsplclose,"SMBsplclose",reply_printclose,AS_USER}, - {SMBsplretq,"SMBsplretq",reply_printqueue,AS_USER}, + {SMBsplretq,"SMBsplretq",reply_printqueue,AS_USER|AS_GUEST}, {SMBsplwr,"SMBsplwr",reply_printwrite,AS_USER}, {SMBlock,"SMBlock",reply_lock,AS_USER}, {SMBunlock,"SMBunlock",reply_unlock,AS_USER}, @@ -3159,8 +3159,17 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize unbecome_user(); /* does this protocol need to be run as the connected user? */ - if ((flags & AS_USER) && !become_user(cnum,uid)) - return(ERROR(ERRSRV,ERRinvnid)); + if ((flags & AS_USER) && !become_user(cnum,uid)) { + if (flags & AS_GUEST) + flags &= ~AS_USER; + else + return(ERROR(ERRSRV,ERRinvnid)); + } + /* this code is to work around a bug is MS client 3 without + introducing a security hole - it needs to be able to do + print queue checks as guest if it isn't logged in properly */ + if (flags & AS_USER) + flags &= ~AS_GUEST; /* does it need write permission? */ if ((flags & NEED_WRITE) && !CAN_WRITE(cnum)) @@ -3744,7 +3753,7 @@ static void usage(char *pname) if (!open_sockets(is_daemon,port)) exit(1); -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES if (!start_share_mode_mgmt()) exit(1); #endif @@ -3763,7 +3772,7 @@ static void usage(char *pname) process(); close_sockets(); -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES stop_share_mode_mgmt(); #endif diff --git a/source3/utils/status.c b/source3/utils/status.c index c9fda5d359..ab61a4db89 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -55,7 +55,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */ BOOL firstopen=True; BOOL processes_only=False; int last_pid=0; -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES pstring shmem_file_name; share_mode_record *scanner_p; share_mode_record *prev_p; @@ -165,7 +165,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */ printf("\n"); -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES /******************************************************************* initialize the shared memory for share_mode management ******************************************************************/ @@ -286,7 +286,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */ } printf(" %s %s",fname,asctime(LocalTime(&t))); -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES prev_p = scanner_p ; scanner_p = (share_mode_record *)shm_offset2addr(scanner_p->next_offset); } /* end while */ @@ -307,7 +307,7 @@ unsigned int Ucrit_IsActive = 0; /* added by OH */ #endif if (firstopen) printf("No locked files\n"); -#ifdef FAST_SHARE_MODES +#if FAST_SHARE_MODES printf("\nShare mode memory usage (bytes):\n"); printf(" %d(%d%%) free + %d(%d%%) used + %d(%d%%) overhead = %d(100%%) total\n", bytes_free, (bytes_free * 100)/bytes_total, |