mirror of
https://github.com/samba-team/samba.git
synced 2025-12-12 12:23:50 +03:00
Makefile: Changed for HPUX10 tidyup.
includes.h: Changed for HPUX10 tidyup.
ipc.c: Fixed bug where getting local server list from NT browsers would
fail.
nmbsync.c: Fixed bug where getting local server list from NT browsers would
fail.
proto.h: Changed for crash bug on SCO with USE_MMAP.
quotas.c: Added OSF quotas (patch from Bret Giddings <bret@essex.ac.uk>).
Rolled back solaris uid change - I think it was wrong.
reply.c: Changed for crash bug on SCO with USE_MMAP.
server.c: Removed Lukes changes. Changed for crash bug on SCO with USE_MMAP.
smb.h: Changed for crash bug on SCO with USE_MMAP.
smbpasswd.c:Fixed crash bug with Lukes changes.
uid.c: Removed Lukes changes.
util.c: Fixed I18N bug with extended char filenames and widelinks = no.
Jeremy (jallison@whistle.com)
This commit is contained in:
@@ -541,7 +541,9 @@ char *mktemp(char *); /* No standard include */
|
|||||||
#define NEED_AUTH_PARAMETERS
|
#define NEED_AUTH_PARAMETERS
|
||||||
#endif
|
#endif
|
||||||
#define SIGNAL_CAST (void (*)(__harg))
|
#define SIGNAL_CAST (void (*)(__harg))
|
||||||
|
#ifndef HPUX10 /* This is only needed for HPUX 9.x */
|
||||||
#define SELECT_CAST (int *)
|
#define SELECT_CAST (int *)
|
||||||
|
#endif /* HPUX10 */
|
||||||
#define SYSV
|
#define SYSV
|
||||||
#define USE_WAITPID
|
#define USE_WAITPID
|
||||||
#define WAIT3_CAST2 (int *)
|
#define WAIT3_CAST2 (int *)
|
||||||
@@ -550,7 +552,7 @@ char *mktemp(char *); /* No standard include */
|
|||||||
#define USE_SETRES
|
#define USE_SETRES
|
||||||
#define DEFAULT_PRINTING PRINT_HPUX
|
#define DEFAULT_PRINTING PRINT_HPUX
|
||||||
#define SIGCLD_IGNORE
|
#define SIGCLD_IGNORE
|
||||||
#endif
|
#endif /* HPUX */
|
||||||
|
|
||||||
|
|
||||||
#ifdef SEQUENT
|
#ifdef SEQUENT
|
||||||
|
|||||||
@@ -703,8 +703,8 @@ void close_file(int fnum);
|
|||||||
BOOL check_file_sharing(int cnum,char *fname);
|
BOOL check_file_sharing(int cnum,char *fname);
|
||||||
void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
|
void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
|
||||||
int mode,int *Access,int *action);
|
int mode,int *Access,int *action);
|
||||||
int seek_file(int fnum,int pos);
|
int seek_file(int fnum,uint32 pos);
|
||||||
int read_file(int fnum,char *data,int pos,int n);
|
int read_file(int fnum,char *data,uint32 pos,int n);
|
||||||
int write_file(int fnum,char *data,int n);
|
int write_file(int fnum,char *data,int n);
|
||||||
BOOL become_service(int cnum,BOOL do_chdir);
|
BOOL become_service(int cnum,BOOL do_chdir);
|
||||||
int find_service(char *service);
|
int find_service(char *service);
|
||||||
|
|||||||
@@ -314,11 +314,11 @@ typedef struct
|
|||||||
int cnum;
|
int cnum;
|
||||||
file_fd_struct *fd_ptr;
|
file_fd_struct *fd_ptr;
|
||||||
int pos;
|
int pos;
|
||||||
int size;
|
uint32 size;
|
||||||
int mode;
|
int mode;
|
||||||
int uid;
|
int uid;
|
||||||
char *mmap_ptr;
|
char *mmap_ptr;
|
||||||
int mmap_size;
|
uint32 mmap_size;
|
||||||
write_bmpx_struct *wbmpx_ptr;
|
write_bmpx_struct *wbmpx_ptr;
|
||||||
struct timeval open_time;
|
struct timeval open_time;
|
||||||
BOOL open;
|
BOOL open;
|
||||||
|
|||||||
@@ -1260,11 +1260,18 @@ int ChDir(char *path)
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
static char *Dumb_GetWd(char *s)
|
static char *Dumb_GetWd(char *s)
|
||||||
{
|
{
|
||||||
|
char *p;
|
||||||
#ifdef USE_GETCWD
|
#ifdef USE_GETCWD
|
||||||
return ((char *)getcwd(s,sizeof(pstring)));
|
p = (char *)getcwd(s,sizeof(pstring));
|
||||||
#else
|
#else
|
||||||
return ((char *)getwd(s));
|
p = (char *)getwd(s));
|
||||||
#endif
|
#endif
|
||||||
|
if(!p)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Ensure we always return in dos format. */
|
||||||
|
unix_to_dos(p,True);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -176,12 +176,14 @@ void sync_browse_lists(struct subnet_record *d, struct work_record *work,
|
|||||||
if (cli_open_sockets(SMB_PORT))
|
if (cli_open_sockets(SMB_PORT))
|
||||||
{
|
{
|
||||||
if (cli_send_login(NULL,NULL,True,True))
|
if (cli_send_login(NULL,NULL,True,True))
|
||||||
{
|
{
|
||||||
add_info(d, work, local_type|SV_TYPE_DOMAIN_ENUM);
|
add_info(d, work, local_type|SV_TYPE_DOMAIN_ENUM);
|
||||||
add_info(d, work, local_type|(SV_TYPE_ALL&
|
if(local)
|
||||||
~(SV_TYPE_DOMAIN_ENUM|SV_TYPE_LOCAL_LIST_ONLY)));
|
add_info(d, work, SV_TYPE_LOCAL_LIST_ONLY);
|
||||||
}
|
else
|
||||||
|
add_info(d, work, SV_TYPE_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
close_sockets();
|
close_sockets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -991,6 +991,15 @@ static BOOL api_RNetServerEnum(int cnum, uint16 vuid, char *param, char *data,
|
|||||||
if (servertype == SV_TYPE_ALL)
|
if (servertype == SV_TYPE_ALL)
|
||||||
servertype &= ~(SV_TYPE_DOMAIN_ENUM|SV_TYPE_LOCAL_LIST_ONLY);
|
servertype &= ~(SV_TYPE_DOMAIN_ENUM|SV_TYPE_LOCAL_LIST_ONLY);
|
||||||
|
|
||||||
|
/* If someone sets SV_TYPE_LOCAL_LIST_ONLY but hasn't set
|
||||||
|
any other bit (they may just set this bit on it's own) they
|
||||||
|
want all the locally seen servers. However this bit can be
|
||||||
|
set on its own so set the requested servers to be
|
||||||
|
ALL - DOMAIN_ENUM. */
|
||||||
|
|
||||||
|
if ((servertype & SV_TYPE_LOCAL_LIST_ONLY) && !(servertype & SV_TYPE_DOMAIN_ENUM))
|
||||||
|
servertype = SV_TYPE_ALL & ~(SV_TYPE_DOMAIN_ENUM);
|
||||||
|
|
||||||
domain_request = ((servertype & SV_TYPE_DOMAIN_ENUM) != 0);
|
domain_request = ((servertype & SV_TYPE_DOMAIN_ENUM) != 0);
|
||||||
local_request = ((servertype & SV_TYPE_LOCAL_LIST_ONLY) != 0);
|
local_request = ((servertype & SV_TYPE_LOCAL_LIST_ONLY) != 0);
|
||||||
|
|
||||||
|
|||||||
@@ -331,8 +331,8 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
|
|||||||
ret = quotactl(Q_GETQUOTA, name, euser_id, &D);
|
ret = quotactl(Q_GETQUOTA, name, euser_id, &D);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
seteuid(euser_id); /* Restore the original uid status. */
|
setuid(user_id); /* Restore the original uid status. */
|
||||||
setuid(user_id);
|
seteuid(euser_id);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
|
DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
|
||||||
@@ -363,6 +363,47 @@ DEBUG(5,("disk_quotas for path \"%s\" returning bsize %d, dfree %d, dsize %d\n"
|
|||||||
return(True);
|
return(True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(OSF1)
|
||||||
|
#include <ufs/quota.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
try to get the disk space from disk quotas - OFS1 version
|
||||||
|
****************************************************************************/
|
||||||
|
BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
|
||||||
|
{
|
||||||
|
uid_t user_id, euser_id;
|
||||||
|
int r;
|
||||||
|
struct dqblk D;
|
||||||
|
struct stat S;
|
||||||
|
|
||||||
|
euser_id = geteuid();
|
||||||
|
user_id = getuid();
|
||||||
|
|
||||||
|
setreuid(euser_id, euser_id);
|
||||||
|
r= quotactl(path,QCMD(Q_GETQUOTA, USRQUOTA),euser_id,(char *) &D);
|
||||||
|
if (setreuid(user_id, euser_id) == -1)
|
||||||
|
DEBUG(5,("Unable to reset uid to %d\n", user_id));
|
||||||
|
|
||||||
|
*bsize = DEV_BSIZE;
|
||||||
|
|
||||||
|
if (r)
|
||||||
|
return(False);
|
||||||
|
|
||||||
|
/* Use softlimit to determine disk space, except when it has been exceeded */
|
||||||
|
|
||||||
|
if (D.dqb_bsoftlimit==0)
|
||||||
|
return(False);
|
||||||
|
|
||||||
|
if ((D.dqb_curblocks>D.dqb_bsoftlimit)) {
|
||||||
|
*dfree = 0;
|
||||||
|
*dsize = D.dqb_curblocks;
|
||||||
|
} else {
|
||||||
|
*dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
|
||||||
|
*dsize = D.dqb_bsoftlimit;
|
||||||
|
}
|
||||||
|
return (True);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
|||||||
@@ -1374,7 +1374,7 @@ int reply_readbraw(char *inbuf, char *outbuf)
|
|||||||
{
|
{
|
||||||
int cnum,maxcount,mincount,fnum;
|
int cnum,maxcount,mincount,fnum;
|
||||||
int nread = 0;
|
int nread = 0;
|
||||||
int startpos;
|
uint32 startpos;
|
||||||
char *header = outbuf;
|
char *header = outbuf;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -1418,7 +1418,7 @@ int reply_readbraw(char *inbuf, char *outbuf)
|
|||||||
Files[fnum].size = size;
|
Files[fnum].size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
nread = MIN(maxcount,size - startpos);
|
nread = MIN(maxcount,(int)(size - startpos));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread < mincount)
|
if (nread < mincount)
|
||||||
@@ -1515,7 +1515,7 @@ int reply_read(char *inbuf,char *outbuf)
|
|||||||
int cnum,numtoread,fnum;
|
int cnum,numtoread,fnum;
|
||||||
int nread = 0;
|
int nread = 0;
|
||||||
char *data;
|
char *data;
|
||||||
int startpos;
|
uint32 startpos;
|
||||||
int outsize = 0;
|
int outsize = 0;
|
||||||
|
|
||||||
cnum = SVAL(inbuf,smb_tid);
|
cnum = SVAL(inbuf,smb_tid);
|
||||||
@@ -3081,7 +3081,7 @@ int reply_readbmpx(char *inbuf,char *outbuf,int length,int bufsize)
|
|||||||
int nread = -1;
|
int nread = -1;
|
||||||
int total_read;
|
int total_read;
|
||||||
char *data;
|
char *data;
|
||||||
int32 startpos;
|
uint32 startpos;
|
||||||
int outsize, mincount, maxcount;
|
int outsize, mincount, maxcount;
|
||||||
int max_per_packet;
|
int max_per_packet;
|
||||||
int tcount;
|
int tcount;
|
||||||
@@ -3152,7 +3152,7 @@ int reply_writebmpx(char *inbuf,char *outbuf)
|
|||||||
int cnum,numtowrite,fnum;
|
int cnum,numtowrite,fnum;
|
||||||
int nwritten = -1;
|
int nwritten = -1;
|
||||||
int outsize = 0;
|
int outsize = 0;
|
||||||
int32 startpos;
|
uint32 startpos;
|
||||||
int tcount, write_through, smb_doff;
|
int tcount, write_through, smb_doff;
|
||||||
char *data;
|
char *data;
|
||||||
|
|
||||||
|
|||||||
@@ -1704,20 +1704,21 @@ void open_file_shared(int fnum,int cnum,char *fname,int share_mode,int ofun,
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
seek a file. Try to avoid the seek if possible
|
seek a file. Try to avoid the seek if possible
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int seek_file(int fnum,int pos)
|
int seek_file(int fnum,uint32 pos)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
uint32 offset = 0;
|
||||||
if (Files[fnum].print_file && POSTSCRIPT(Files[fnum].cnum))
|
if (Files[fnum].print_file && POSTSCRIPT(Files[fnum].cnum))
|
||||||
offset = 3;
|
offset = 3;
|
||||||
|
|
||||||
Files[fnum].pos = lseek(Files[fnum].fd_ptr->fd,pos+offset,SEEK_SET) - offset;
|
Files[fnum].pos = (int)(lseek(Files[fnum].fd_ptr->fd,pos+offset,SEEK_SET)
|
||||||
|
- offset);
|
||||||
return(Files[fnum].pos);
|
return(Files[fnum].pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
read from a file
|
read from a file
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int read_file(int fnum,char *data,int pos,int n)
|
int read_file(int fnum,char *data,uint32 pos,int n)
|
||||||
{
|
{
|
||||||
int ret=0,readret;
|
int ret=0,readret;
|
||||||
|
|
||||||
@@ -1733,7 +1734,7 @@ int read_file(int fnum,char *data,int pos,int n)
|
|||||||
#if USE_MMAP
|
#if USE_MMAP
|
||||||
if (Files[fnum].mmap_ptr)
|
if (Files[fnum].mmap_ptr)
|
||||||
{
|
{
|
||||||
int num = MIN(n,Files[fnum].mmap_size-pos);
|
int num = MIN(n,(int)(Files[fnum].mmap_size-pos));
|
||||||
if (num > 0)
|
if (num > 0)
|
||||||
{
|
{
|
||||||
memcpy(data,Files[fnum].mmap_ptr+pos,num);
|
memcpy(data,Files[fnum].mmap_ptr+pos,num);
|
||||||
@@ -2541,22 +2542,25 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
|
|||||||
pcon->ngroups = 0;
|
pcon->ngroups = 0;
|
||||||
pcon->groups = NULL;
|
pcon->groups = NULL;
|
||||||
|
|
||||||
/* Find all the groups this uid is in and store them. Used by become_user() */
|
if (!IS_IPC(cnum))
|
||||||
setup_groups(pcon->user,pcon->uid,pcon->gid,&pcon->ngroups,&pcon->igroups,&pcon->groups);
|
{
|
||||||
|
/* Find all the groups this uid is in and store them. Used by become_user() */
|
||||||
|
setup_groups(pcon->user,pcon->uid,pcon->gid,&pcon->ngroups,&pcon->igroups,&pcon->groups);
|
||||||
|
|
||||||
/* check number of connections */
|
/* check number of connections */
|
||||||
if (!claim_connection(cnum,
|
if (!claim_connection(cnum,
|
||||||
lp_servicename(SNUM(cnum)),
|
lp_servicename(SNUM(cnum)),
|
||||||
lp_max_connections(SNUM(cnum)),False))
|
lp_max_connections(SNUM(cnum)),False))
|
||||||
{
|
{
|
||||||
DEBUG(1,("too many connections - rejected\n"));
|
DEBUG(1,("too many connections - rejected\n"));
|
||||||
return(-8);
|
return(-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lp_status(SNUM(cnum)))
|
if (lp_status(SNUM(cnum)))
|
||||||
claim_connection(cnum,"STATUS.",MAXSTATUS,first_connection);
|
claim_connection(cnum,"STATUS.",MAXSTATUS,first_connection);
|
||||||
|
|
||||||
first_connection = False;
|
first_connection = False;
|
||||||
|
} /* IS_IPC */
|
||||||
|
|
||||||
pcon->open = True;
|
pcon->open = True;
|
||||||
|
|
||||||
@@ -2574,13 +2578,13 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
|
|||||||
{
|
{
|
||||||
DEBUG(0,("Can't become connected user!\n"));
|
DEBUG(0,("Can't become connected user!\n"));
|
||||||
pcon->open = False;
|
pcon->open = False;
|
||||||
yield_connection(cnum,
|
if (!IS_IPC(cnum)) {
|
||||||
|
yield_connection(cnum,
|
||||||
lp_servicename(SNUM(cnum)),
|
lp_servicename(SNUM(cnum)),
|
||||||
lp_max_connections(SNUM(cnum)));
|
lp_max_connections(SNUM(cnum)));
|
||||||
if (lp_status(SNUM(cnum))) yield_connection(cnum,"STATUS.",MAXSTATUS);
|
if (lp_status(SNUM(cnum))) yield_connection(cnum,"STATUS.",MAXSTATUS);
|
||||||
{
|
|
||||||
return(-1);
|
|
||||||
}
|
}
|
||||||
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChDir(pcon->connectpath) != 0)
|
if (ChDir(pcon->connectpath) != 0)
|
||||||
@@ -2589,13 +2593,13 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
|
|||||||
pcon->connectpath,strerror(errno)));
|
pcon->connectpath,strerror(errno)));
|
||||||
pcon->open = False;
|
pcon->open = False;
|
||||||
unbecome_user();
|
unbecome_user();
|
||||||
yield_connection(cnum,
|
if (!IS_IPC(cnum)) {
|
||||||
|
yield_connection(cnum,
|
||||||
lp_servicename(SNUM(cnum)),
|
lp_servicename(SNUM(cnum)),
|
||||||
lp_max_connections(SNUM(cnum)));
|
lp_max_connections(SNUM(cnum)));
|
||||||
if (lp_status(SNUM(cnum))) yield_connection(cnum,"STATUS.",MAXSTATUS);
|
if (lp_status(SNUM(cnum))) yield_connection(cnum,"STATUS.",MAXSTATUS);
|
||||||
{
|
|
||||||
return(-5);
|
|
||||||
}
|
}
|
||||||
|
return(-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
string_set(&pcon->origpath,pcon->connectpath);
|
string_set(&pcon->origpath,pcon->connectpath);
|
||||||
@@ -3420,7 +3424,7 @@ void exit_server(char *reason)
|
|||||||
DEBUG(2,("Closing connections\n"));
|
DEBUG(2,("Closing connections\n"));
|
||||||
for (i=0;i<MAX_CONNECTIONS;i++)
|
for (i=0;i<MAX_CONNECTIONS;i++)
|
||||||
if (Connections[i].open)
|
if (Connections[i].open)
|
||||||
close_cnum(i,-1);
|
close_cnum(i,(uint16)-1);
|
||||||
#ifdef DFS_AUTH
|
#ifdef DFS_AUTH
|
||||||
if (dcelogin_atmost_once)
|
if (dcelogin_atmost_once)
|
||||||
dfs_unlogin();
|
dfs_unlogin();
|
||||||
|
|||||||
@@ -253,10 +253,12 @@ BOOL become_user(int cnum, uint16 vuid)
|
|||||||
if (!become_gid(gid)) return(False);
|
if (!become_gid(gid)) return(False);
|
||||||
|
|
||||||
#ifndef NO_SETGROUPS
|
#ifndef NO_SETGROUPS
|
||||||
|
if (!IS_IPC(cnum)) {
|
||||||
/* groups stuff added by ih/wreu */
|
/* groups stuff added by ih/wreu */
|
||||||
if (current_user.ngroups > 0)
|
if (current_user.ngroups > 0)
|
||||||
if (setgroups(current_user.ngroups,current_user.groups)<0)
|
if (setgroups(current_user.ngroups,current_user.groups)<0)
|
||||||
DEBUG(0,("setgroups call failed!\n"));
|
DEBUG(0,("setgroups call failed!\n"));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!Connections[cnum].admin_user && !become_uid(uid))
|
if (!Connections[cnum].admin_user && !become_uid(uid))
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ static void usage(char *name)
|
|||||||
if ((argv[1][0] == '-') && (argv[1][1] == 'a'))
|
if ((argv[1][0] == '-') && (argv[1][1] == 'a'))
|
||||||
add_user = True;
|
add_user = True;
|
||||||
|
|
||||||
if(add_user && (argc < 2 || argc > 4))
|
if(add_user && (argc <= 2 || argc > 4))
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
|
||||||
/* root can specify password on command-line */
|
/* root can specify password on command-line */
|
||||||
@@ -338,7 +338,7 @@ static void usage(char *name)
|
|||||||
|
|
||||||
p = getpass("Retype new SMB password:");
|
p = getpass("Retype new SMB password:");
|
||||||
|
|
||||||
if (strcmp(p, new_passwd))
|
if (strncmp(p, new_passwd, sizeof(fstring)-1))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Mismatch - password unchanged.\n", argv[0]);
|
fprintf(stderr, "%s: Mismatch - password unchanged.\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user