mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
Makefile.in configure configure.in include/proto.h smbd/noquotas.c smbd/quotas.c:
Added quotas patch for autoconf from Dejan Ilic <svedja@lysator.liu.se>. printing/printing.c: Filenames with spaces patch from Allan Bjorklund <allan@umich.edu> utils/nmblookup.c: Fix usage() function. smbd/reply.c: Split out the security=server and security=domain checks into check_server_security() and check_domain_security() to aid the writing of the 'hack' appliance mode invented by John Schimmel. Jeremy. (This used to be commit f09ab9b52251087a58af92ec753537ca34a970fc)
This commit is contained in:
parent
5900f6c85b
commit
01e04614c7
@ -79,6 +79,7 @@ PROGS = $(PROGS1) $(PROGS2) $(MPROGS) bin/nmblookup bin/make_printerdef
|
||||
|
||||
SCRIPTS = script/smbtar script/addtosmbpass
|
||||
|
||||
QUOTAOBJS=@QUOTAOBJS@
|
||||
|
||||
######################################################################
|
||||
# object file lists
|
||||
@ -132,7 +133,7 @@ SMBD_OBJ1 = smbd/server.o smbd/files.o smbd/chgpasswd.o smbd/connection.o \
|
||||
smbd/dfree.o smbd/dir.o smbd/password.o smbd/conn.o smbd/fileio.o \
|
||||
smbd/ipc.o smbd/mangle.o smbd/negprot.o \
|
||||
smbd/message.o smbd/nttrans.o smbd/pipes.o smbd/predict.o \
|
||||
smbd/quotas.o smbd/reply.o smbd/ssl.o smbd/trans2.o smbd/uid.o \
|
||||
smbd/$(QUOTAOBJS) smbd/reply.o smbd/ssl.o smbd/trans2.o smbd/uid.o \
|
||||
smbd/dosmode.o smbd/filename.o smbd/open.o smbd/close.o smbd/blocking.o \
|
||||
smbd/process.o smbd/oplock.o smbd/service.o smbd/error.o
|
||||
|
||||
|
798
source3/configure
vendored
798
source3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -762,6 +762,26 @@ AC_ARG_WITH(netatalk,
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
#################################################
|
||||
# check for experimental disk-quotas support
|
||||
QUOTAOBJS=noquotas.o
|
||||
|
||||
AC_MSG_CHECKING(whether to support disk-quotas)
|
||||
AC_ARG_WITH(quotas,
|
||||
[ --with-quotas Include experimental disk-quota support
|
||||
--without-quotas Don't include experimental disk-quota support (default)],
|
||||
[ case "$withval" in
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
QUOTAOBJS=quotas.o
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
AC_SUBST(QUOTAOBJS)
|
||||
|
||||
#################################################
|
||||
# these tests are taken from the GNU fileutils package
|
||||
|
@ -2194,6 +2194,10 @@ int reply_negprot(connection_struct *conn,
|
||||
char *inbuf,char *outbuf, int dum_size,
|
||||
int dum_buffsize);
|
||||
|
||||
/*The following definitions come from smbd/noquotas.c */
|
||||
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
|
||||
/*The following definitions come from smbd/nttrans.c */
|
||||
|
||||
int reply_ntcreate_and_X(connection_struct *conn,
|
||||
@ -2283,15 +2287,6 @@ void construct_reply_common(char *inbuf,char *outbuf);
|
||||
int chain_reply(char *inbuf,char *outbuf,int size,int bufsize);
|
||||
void smbd_process(void);
|
||||
|
||||
/*The following definitions come from smbd/quotas.c */
|
||||
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
|
||||
|
||||
/*The following definitions come from smbd/reply.c */
|
||||
|
||||
int reply_special(char *inbuf,char *outbuf);
|
||||
|
@ -193,6 +193,11 @@ here is an example of lpq output under osf/1
|
||||
Warning: no daemon present
|
||||
Rank Pri Owner Job Files Total Size
|
||||
1st 0 tridge 148 README 8096 bytes
|
||||
|
||||
|
||||
<allan@umich.edu> June 30, 1998.
|
||||
Modified to handle file names with spaces, like the parse_lpq_lprng code
|
||||
further below.
|
||||
****************************************************************************/
|
||||
static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
|
||||
{
|
||||
@ -202,19 +207,21 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
|
||||
#define USERTOK 2
|
||||
#define JOBTOK 3
|
||||
#define FILETOK 4
|
||||
#define TOTALTOK 5
|
||||
#define TOTALTOK (count - 1)
|
||||
#define NTOK 6
|
||||
#define MAXTOK 128
|
||||
#else /* OSF1 */
|
||||
#define RANKTOK 0
|
||||
#define USERTOK 1
|
||||
#define JOBTOK 2
|
||||
#define FILETOK 3
|
||||
#define TOTALTOK 4
|
||||
#define TOTALTOK (count - 1)
|
||||
#define NTOK 5
|
||||
#define MAXTOK 128
|
||||
#endif /* OSF1 */
|
||||
|
||||
fstring tok[NTOK];
|
||||
int count=0;
|
||||
char *tok[MAXTOK];
|
||||
int count = 0;
|
||||
|
||||
#ifdef OSF1
|
||||
int length;
|
||||
@ -223,38 +230,19 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
|
||||
return(False);
|
||||
#endif /* OSF1 */
|
||||
|
||||
/* handle the case of "(standard input)" as a filename */
|
||||
string_sub(line,"standard input","STDIN");
|
||||
string_sub(line,"(","\"");
|
||||
string_sub(line,")","\"");
|
||||
|
||||
for (count=0;
|
||||
count<NTOK &&
|
||||
next_token(&line,tok[count],NULL, sizeof(tok[count]));
|
||||
count++) ;
|
||||
tok[0] = strtok(line," \t");
|
||||
count++;
|
||||
|
||||
/* we must get NTOK tokens */
|
||||
while (((tok[count] = strtok(NULL," \t")) != NULL) && (count < MAXTOK)) {
|
||||
count++;
|
||||
}
|
||||
|
||||
/* we must get at least NTOK tokens */
|
||||
if (count < NTOK)
|
||||
return(False);
|
||||
|
||||
/* the Job and Total columns must be integer */
|
||||
if (!isdigit((int)*tok[JOBTOK]) || !isdigit((int)*tok[TOTALTOK])) return(False);
|
||||
|
||||
/* if the fname contains a space then use STDIN */
|
||||
if (strchr(tok[FILETOK],' '))
|
||||
fstrcpy(tok[FILETOK],"STDIN");
|
||||
|
||||
/* only take the last part of the filename */
|
||||
{
|
||||
fstring tmp;
|
||||
char *p = strrchr(tok[FILETOK],'/');
|
||||
if (p)
|
||||
{
|
||||
fstrcpy(tmp,p+1);
|
||||
fstrcpy(tok[FILETOK],tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isdigit(*tok[JOBTOK]) || !isdigit(*tok[TOTALTOK])) return(False);
|
||||
|
||||
buf->job = atoi(tok[JOBTOK]);
|
||||
buf->size = atoi(tok[TOTALTOK]);
|
||||
@ -262,6 +250,23 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
|
||||
buf->time = time(NULL);
|
||||
StrnCpy(buf->user,tok[USERTOK],sizeof(buf->user)-1);
|
||||
StrnCpy(buf->file,tok[FILETOK],sizeof(buf->file)-1);
|
||||
|
||||
if ((FILETOK + 1) != TOTALTOK) {
|
||||
int bufsize;
|
||||
int i;
|
||||
|
||||
bufsize = sizeof(buf->file) - strlen(buf->file) - 1;
|
||||
|
||||
for (i = (FILETOK + 1); i < TOTALTOK; i++) {
|
||||
strncat(buf->file," ",bufsize);
|
||||
strncat(buf->file,tok[i],bufsize - 1);
|
||||
bufsize = sizeof(buf->file) - strlen(buf->file) - 1;
|
||||
if (bufsize <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PRIOTOK
|
||||
buf->priority = atoi(tok[PRIOTOK]);
|
||||
#else
|
||||
@ -274,19 +279,20 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
|
||||
<magnus@hum.auc.dk>
|
||||
LPRng_time modifies the current date by inserting the hour and minute from
|
||||
the lpq output. The lpq time looks like "23:15:07"
|
||||
|
||||
<allan@umich.edu> June 30, 1998.
|
||||
Modified to work with the re-written parse_lpq_lprng routine.
|
||||
*/
|
||||
static time_t LPRng_time(fstring tok[],int pos)
|
||||
static time_t LPRng_time(char *time_string)
|
||||
{
|
||||
time_t jobtime;
|
||||
struct tm *t;
|
||||
fstring tmp_time;
|
||||
|
||||
jobtime = time(NULL); /* default case: take current time */
|
||||
t = localtime(&jobtime);
|
||||
t->tm_hour = atoi(tok[pos]);
|
||||
fstrcpy(tmp_time,tok[pos]);
|
||||
t->tm_min = atoi(tmp_time+3);
|
||||
t->tm_sec = atoi(tmp_time+6);
|
||||
t->tm_hour = atoi(time_string);
|
||||
t->tm_min = atoi(time_string+3);
|
||||
t->tm_sec = atoi(time_string+6);
|
||||
jobtime = mktime(t);
|
||||
|
||||
return jobtime;
|
||||
@ -294,162 +300,86 @@ static time_t LPRng_time(fstring tok[],int pos)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
parse a lpq line
|
||||
<magnus@hum.auc.dk>
|
||||
Most of the code is directly reused from parse_lpq_bsd()
|
||||
|
||||
here are two examples of lpq output under lprng (LPRng-2.3.0)
|
||||
|
||||
Printer: humprn@hum-fak
|
||||
Queue: 1 printable job
|
||||
Server: pid 4840 active, Unspooler: pid 4841 active
|
||||
Status: job 'cfA659hum-fak', closing device at Fri Jun 21 10:10:21 1996
|
||||
Rank Owner Class Job Files Size Time
|
||||
active magnus@hum-fak A 659 /var/spool/smb/Notesblok-ikke-na4024 10:03:31
|
||||
|
||||
Printer: humprn@hum-fak (printing disabled)
|
||||
Queue: 1 printable job
|
||||
Warning: no server present
|
||||
Status: finished operations at Fri Jun 21 10:10:32 1996
|
||||
Rank Owner Class Job Files Size Time
|
||||
1 magnus@hum-fak A 387 /var/spool/smb/netbudget.xls 21230 10:50:53
|
||||
|
||||
******************************************************************************
|
||||
|
||||
NEW FOR LPRng-3.3.5 !
|
||||
|
||||
<reinelt@eunet.at>
|
||||
This will not happen anymore: with LPRng-3.3.5 there is always a blank between
|
||||
the filename and the size, and the format has changed:
|
||||
|
||||
Printer: lj6@lizard 'HP LaserJet 6P'
|
||||
Queue: 2 printable jobs
|
||||
Server: pid 11941 active
|
||||
Unspooler: pid 11942 active
|
||||
Status: printed all 1818 bytes at 19:49:59
|
||||
Rank Owner/ID Class Job Files Size Time
|
||||
active root@lizard+937 A 937 (stdin) 1818 19:49:58
|
||||
2 root@lizard+969 A 969 junk.txt 2170 19:50:12
|
||||
|
||||
parse a lprng lpq line
|
||||
<allan@umich.edu> June 30, 1998.
|
||||
Re-wrote this to handle file names with spaces, multiple file names on one
|
||||
lpq line, etc;
|
||||
****************************************************************************/
|
||||
static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
|
||||
{
|
||||
#define LPRNG_RANKTOK 0
|
||||
#define LPRNG_USERTOK 1
|
||||
#define LPRNG_PRIOTOK 2
|
||||
#define LPRNG_JOBTOK 3
|
||||
#define LPRNG_FILETOK 4
|
||||
#define LPRNG_TOTALTOK 5
|
||||
#define LPRNG_TIMETOK 6
|
||||
#define LPRNG_NTOK 7
|
||||
#define LPRNG_RANKTOK 0
|
||||
#define LPRNG_USERTOK 1
|
||||
#define LPRNG_PRIOTOK 2
|
||||
#define LPRNG_JOBTOK 3
|
||||
#define LPRNG_FILETOK 4
|
||||
#define LPRNG_TOTALTOK (num_tok - 2)
|
||||
#define LPRNG_TIMETOK (num_tok - 1)
|
||||
#define LPRNG_NTOK 7
|
||||
#define LPRNG_MAXTOK 128 /* PFMA just to keep us from running away. */
|
||||
|
||||
/****************************************************************************
|
||||
From lpd_status.c in LPRng source.
|
||||
0 1 2 3 4 5 6 7
|
||||
12345678901234567890123456789012345678901234567890123456789012345678901234
|
||||
" Rank Owner Class Job Files Size Time"
|
||||
plp_snprintf( msg, sizeof(msg), "%-6s %-19s %c %03d %-32s",
|
||||
number, line, priority, cfp->number, error );
|
||||
plp_snprintf( msg + len, sizeof(msg)-len, "%4d",
|
||||
cfp->jobsize );
|
||||
plp_snprintf( msg+len, sizeof(msg)-len, " %s",
|
||||
Time_str( 1, cfp->statb.st_ctime ) );
|
||||
****************************************************************************/
|
||||
/* The following define's are to be able to adjust the values if the
|
||||
LPRng source changes. This is from version 2.3.0. Magnus */
|
||||
#define SPACE_W 1
|
||||
#define RANK_W 6
|
||||
#define OWNER_W 19
|
||||
#define CLASS_W 1
|
||||
#define JOB_W 3
|
||||
#define FILE_W 32
|
||||
/* The JOBSIZE_W is too small for big jobs, so time is pushed to the right */
|
||||
#define JOBSIZE_W 4
|
||||
|
||||
#define RANK_POS 0
|
||||
#define OWNER_POS RANK_POS+RANK_W+SPACE_W
|
||||
#define CLASS_POS OWNER_POS+OWNER_W+SPACE_W
|
||||
#define JOB_POS CLASS_POS+CLASS_W+SPACE_W
|
||||
#define FILE_POS JOB_POS+JOB_W+SPACE_W
|
||||
#define JOBSIZE_POS FILE_POS+FILE_W
|
||||
char *tokarr[LPRNG_MAXTOK];
|
||||
char *cptr;
|
||||
int num_tok = 0;
|
||||
|
||||
|
||||
fstring tok[LPRNG_NTOK];
|
||||
int count=0;
|
||||
|
||||
#ifdef OLD_LPRNG
|
||||
/* We only need this bugfix for older versions of lprng - current
|
||||
information is that version 3.3.5 must not have this line
|
||||
in order to work correctly.
|
||||
*/
|
||||
|
||||
/*
|
||||
Need to insert one space in front of the size, to be able to use
|
||||
next_token() unchanged. I would have liked to be able to insert a
|
||||
space instead, to prevent losing that one char, but perl has spoiled
|
||||
me :-\ So I did it the easiest way.
|
||||
|
||||
HINT: Use as short a path as possible for the samba spool directory.
|
||||
A long spool-path will just waste significant chars of the file name.
|
||||
*/
|
||||
|
||||
line[JOBSIZE_POS-1]=' ';
|
||||
#endif /* OLD_LPRNG */
|
||||
|
||||
/* handle the case of "(stdin)" as a filename */
|
||||
string_sub(line,"stdin","STDIN");
|
||||
string_sub(line,"(","\"");
|
||||
string_sub(line,")","\"");
|
||||
|
||||
for (count=0;
|
||||
count<LPRNG_NTOK &&
|
||||
next_token(&line,tok[count],NULL, sizeof(tok[count]));
|
||||
count++) ;
|
||||
|
||||
/* we must get LPRNG_NTOK tokens */
|
||||
if (count < LPRNG_NTOK)
|
||||
return(False);
|
||||
|
||||
/* the Job and Total columns must be integer */
|
||||
if (!isdigit((int)*tok[LPRNG_JOBTOK]) || !isdigit((int)*tok[LPRNG_TOTALTOK])) return(False);
|
||||
|
||||
/* if the fname contains a space then use STDIN */
|
||||
/* I do not understand how this would be possible. Magnus. */
|
||||
if (strchr(tok[LPRNG_FILETOK],' '))
|
||||
fstrcpy(tok[LPRNG_FILETOK],"STDIN");
|
||||
|
||||
/* only take the last part of the filename */
|
||||
{
|
||||
fstring tmp;
|
||||
char *p = strrchr(tok[LPRNG_FILETOK],'/');
|
||||
if (p)
|
||||
{
|
||||
fstrcpy(tmp,p+1);
|
||||
fstrcpy(tok[LPRNG_FILETOK],tmp);
|
||||
}
|
||||
tokarr[0] = strtok(line," \t");
|
||||
num_tok++;
|
||||
while (((tokarr[num_tok] = strtok(NULL," \t")) != NULL)
|
||||
&& (num_tok < LPRNG_MAXTOK)) {
|
||||
num_tok++;
|
||||
}
|
||||
|
||||
|
||||
buf->job = atoi(tok[LPRNG_JOBTOK]);
|
||||
buf->size = atoi(tok[LPRNG_TOTALTOK]);
|
||||
if (strequal(tok[LPRNG_RANKTOK],"active"))
|
||||
/* We must get at least LPRNG_NTOK tokens. */
|
||||
if (num_tok < LPRNG_NTOK) {
|
||||
return(False);
|
||||
}
|
||||
|
||||
if (!isdigit(*tokarr[LPRNG_JOBTOK]) || !isdigit(*tokarr[LPRNG_TOTALTOK])) {
|
||||
return(False);
|
||||
}
|
||||
|
||||
buf->job = atoi(tokarr[LPRNG_JOBTOK]);
|
||||
buf->size = atoi(tokarr[LPRNG_TOTALTOK]);
|
||||
|
||||
if (strequal(tokarr[LPRNG_RANKTOK],"active")) {
|
||||
buf->status = LPQ_PRINTING;
|
||||
else if (strequal(tok[LPRNG_RANKTOK],"hold"))
|
||||
buf->status = LPQ_PAUSED;
|
||||
else
|
||||
} else if (isdigit(*tokarr[LPRNG_RANKTOK])) {
|
||||
buf->status = LPQ_QUEUED;
|
||||
/* buf->time = time(NULL); */
|
||||
buf->time = LPRng_time(tok,LPRNG_TIMETOK);
|
||||
DEBUG(3,("Time reported for job %d is %s", buf->job, ctime(&buf->time)));
|
||||
StrnCpy(buf->user,tok[LPRNG_USERTOK],sizeof(buf->user)-1);
|
||||
StrnCpy(buf->file,tok[LPRNG_FILETOK],sizeof(buf->file)-1);
|
||||
#ifdef LPRNG_PRIOTOK
|
||||
/* Here I try to map the CLASS char to a number, but the number
|
||||
is never shown in Print Manager under NT anyway... Magnus. */
|
||||
buf->priority = atoi(tok[LPRNG_PRIOTOK]-('A'-1));
|
||||
#else
|
||||
buf->priority = 1;
|
||||
#endif
|
||||
} else {
|
||||
buf->status = LPQ_PAUSED;
|
||||
}
|
||||
|
||||
buf->priority = *tokarr[LPRNG_PRIOTOK] -'A';
|
||||
|
||||
buf->time = LPRng_time(tokarr[LPRNG_TIMETOK]);
|
||||
|
||||
StrnCpy(buf->user,tokarr[LPRNG_USERTOK],sizeof(buf->user)-1);
|
||||
|
||||
/* The '@hostname' prevents windows from displaying the printing icon
|
||||
* for the current user on the taskbar. Plop in a null.
|
||||
*/
|
||||
|
||||
if ((cptr = strchr(buf->user,'@')) != NULL) {
|
||||
*cptr = '\0';
|
||||
}
|
||||
|
||||
StrnCpy(buf->file,tokarr[LPRNG_FILETOK],sizeof(buf->file)-1);
|
||||
|
||||
if ((LPRNG_FILETOK + 1) != LPRNG_TOTALTOK) {
|
||||
int bufsize;
|
||||
int i;
|
||||
|
||||
bufsize = sizeof(buf->file) - strlen(buf->file) - 1;
|
||||
|
||||
for (i = (LPRNG_FILETOK + 1); i < LPRNG_TOTALTOK; i++) {
|
||||
strncat(buf->file," ",bufsize);
|
||||
strncat(buf->file,tokarr[i],bufsize - 1);
|
||||
bufsize = sizeof(buf->file) - strlen(buf->file) - 1;
|
||||
if (bufsize <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(True);
|
||||
}
|
||||
|
||||
|
31
source3/smbd/noquotas.c
Normal file
31
source3/smbd/noquotas.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
No support for quotas :-).
|
||||
Copyright (C) Andrew Tridgell 1992-1998
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
/*
|
||||
* Needed for auto generation of proto.h.
|
||||
*/
|
||||
|
||||
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
|
||||
{
|
||||
return False;
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
#ifdef QUOTAS
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 1.9.
|
||||
@ -658,10 +657,3 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* this keeps fussy compilers happy */
|
||||
void quotas_dummy(void);
|
||||
void quotas_dummy(void) {}
|
||||
#endif /* QUOTAS */
|
||||
|
||||
|
@ -447,10 +447,42 @@ static int session_trust_account(connection_struct *conn, char *inbuf, char *out
|
||||
return(ERROR(0, 0xc0000000|NT_STATUS_LOGON_FAILURE));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Check for a valid username and password in security=server mode.
|
||||
****************************************************************************/
|
||||
|
||||
static BOOL check_server_security(char *orig_user, char *domain,
|
||||
char *smb_apasswd, int smb_apasslen,
|
||||
char *smb_ntpasswd, int smb_ntpasslen)
|
||||
{
|
||||
if(lp_security() != SEC_SERVER)
|
||||
return False;
|
||||
|
||||
return server_validate(orig_user, domain,
|
||||
smb_apasswd, smb_apasslen,
|
||||
smb_ntpasswd, smb_ntpasslen);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Check for a valid username and password in security=domain mode.
|
||||
****************************************************************************/
|
||||
|
||||
static BOOL check_domain_security(char *orig_user, char *domain,
|
||||
char *smb_apasswd, int smb_apasslen,
|
||||
char *smb_ntpasswd, int smb_ntpasslen)
|
||||
{
|
||||
if(lp_security() != SEC_DOMAIN)
|
||||
return False;
|
||||
|
||||
return domain_client_validate(orig_user, domain,
|
||||
smb_apasswd, smb_apasslen,
|
||||
smb_ntpasswd, smb_ntpasslen);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
reply to a session setup command
|
||||
****************************************************************************/
|
||||
|
||||
int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize)
|
||||
{
|
||||
uint16 sess_vuid;
|
||||
@ -582,12 +614,12 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
||||
|
||||
/* If no username is sent use the guest account */
|
||||
if (!*user)
|
||||
{
|
||||
pstrcpy(user,lp_guestaccount(-1));
|
||||
/* If no user and no password then set guest flag. */
|
||||
if( *smb_apasswd == 0)
|
||||
guest = True;
|
||||
}
|
||||
{
|
||||
pstrcpy(user,lp_guestaccount(-1));
|
||||
/* If no user and no password then set guest flag. */
|
||||
if( *smb_apasswd == 0)
|
||||
guest = True;
|
||||
}
|
||||
|
||||
strlower(user);
|
||||
|
||||
@ -631,48 +663,58 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
||||
if(!guest && strequal(user,lp_guestaccount(-1)) && (*smb_apasswd == 0))
|
||||
guest = True;
|
||||
|
||||
if (!guest && !(lp_security() == SEC_SERVER &&
|
||||
/* Check with orig_user for security=server and
|
||||
security=domain. */
|
||||
server_validate(orig_user, domain,
|
||||
smb_apasswd, smb_apasslen,
|
||||
smb_ntpasswd, smb_ntpasslen)) &&
|
||||
!(lp_security() == SEC_DOMAIN &&
|
||||
domain_client_validate(orig_user, domain,
|
||||
/*
|
||||
* Check with orig_user for security=server and
|
||||
* security=domain.
|
||||
*/
|
||||
|
||||
if (!guest &&
|
||||
!check_server_security(orig_user, domain,
|
||||
smb_apasswd, smb_apasslen,
|
||||
smb_ntpasswd, smb_ntpasslen)) &&
|
||||
smb_ntpasswd, smb_ntpasslen) &&
|
||||
!check_domain_security(orig_user, domain,
|
||||
smb_apasswd, smb_apasslen,
|
||||
smb_ntpasswd, smb_ntpasslen) &&
|
||||
!check_hosts_equiv(user)
|
||||
)
|
||||
{
|
||||
{
|
||||
|
||||
/* now check if it's a valid username/password */
|
||||
/* If an NT password was supplied try and validate with that
|
||||
first. This is superior as the passwords are mixed case
|
||||
128 length unicode */
|
||||
if(smb_ntpasslen)
|
||||
{
|
||||
if(!password_ok(user, smb_ntpasswd,smb_ntpasslen,NULL))
|
||||
DEBUG(0,("NT Password did not match ! Defaulting to Lanman\n"));
|
||||
else
|
||||
valid_nt_password = True;
|
||||
}
|
||||
if (!valid_nt_password && !password_ok(user, smb_apasswd,smb_apasslen,NULL))
|
||||
{
|
||||
if (lp_security() >= SEC_USER) {
|
||||
/*
|
||||
* If we get here then the user wasn't guest and the remote
|
||||
* authentication methods failed. Check the authentication
|
||||
* methods on this local server.
|
||||
*
|
||||
* If an NT password was supplied try and validate with that
|
||||
* first. This is superior as the passwords are mixed case
|
||||
* 128 length unicode.
|
||||
*/
|
||||
|
||||
if(smb_ntpasslen)
|
||||
{
|
||||
if(!password_ok(user, smb_ntpasswd,smb_ntpasslen,NULL))
|
||||
DEBUG(0,("NT Password did not match ! Defaulting to Lanman\n"));
|
||||
else
|
||||
valid_nt_password = True;
|
||||
}
|
||||
|
||||
if (!valid_nt_password && !password_ok(user, smb_apasswd,smb_apasslen,NULL))
|
||||
{
|
||||
if (lp_security() >= SEC_USER)
|
||||
{
|
||||
#if (GUEST_SESSSETUP == 0)
|
||||
return(ERROR(ERRSRV,ERRbadpw));
|
||||
return(ERROR(ERRSRV,ERRbadpw));
|
||||
#endif
|
||||
#if (GUEST_SESSSETUP == 1)
|
||||
if (Get_Pwnam(user,True))
|
||||
return(ERROR(ERRSRV,ERRbadpw));
|
||||
if (Get_Pwnam(user,True))
|
||||
return(ERROR(ERRSRV,ERRbadpw));
|
||||
#endif
|
||||
}
|
||||
if (*smb_apasswd || !Get_Pwnam(user,True))
|
||||
pstrcpy(user,lp_guestaccount(-1));
|
||||
DEBUG(3,("Registered username %s for guest access\n",user));
|
||||
guest = True;
|
||||
}
|
||||
}
|
||||
if (*smb_apasswd || !Get_Pwnam(user,True))
|
||||
pstrcpy(user,lp_guestaccount(-1));
|
||||
DEBUG(3,("Registered username %s for guest access\n",user));
|
||||
guest = True;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Get_Pwnam(user,True)) {
|
||||
DEBUG(3,("No such user %s - using guest account\n",user));
|
||||
@ -682,12 +724,12 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
||||
|
||||
if (!strequal(user,lp_guestaccount(-1)) &&
|
||||
lp_servicenumber(user) < 0)
|
||||
{
|
||||
int homes = lp_servicenumber(HOMES_NAME);
|
||||
char *home = get_home_dir(user);
|
||||
if (homes >= 0 && home)
|
||||
lp_add_home(user,homes,home);
|
||||
}
|
||||
{
|
||||
int homes = lp_servicenumber(HOMES_NAME);
|
||||
char *home = get_home_dir(user);
|
||||
if (homes >= 0 && home)
|
||||
lp_add_home(user,homes,home);
|
||||
}
|
||||
|
||||
|
||||
/* it's ok - setup a reply */
|
||||
|
@ -81,6 +81,9 @@ static void usage(void)
|
||||
printf("\t-S lookup node status as well\n");
|
||||
printf("\t-r Use root port 137 (Win95 only replies to this)\n");
|
||||
printf("\t-A Do a node status on <name> as an IP Address\n");
|
||||
printf("\t-i NetBIOS scope Use the given NetBIOS scope for name queries\n");
|
||||
printf("\t-s smb.conf file Use the given path to the smb.conf file\n");
|
||||
printf("\t-h Print this help message.\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user