1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Changes to test in configure if capabilities are enabled on a system.

Changes to get Samba to compile cleanly with the IRIX compiler
with the options : -fullwarn -woff 1209,1174 (the -woff options
are to turn off warnings about unused function parameters and
controlling loop expressions being constants).
Split prototype generation as we hit a limit in IRIX nawk.
Removed "." code in smbd/filename.c (yet again :-).
Jeremy.
(This used to be commit e0567433bd)
This commit is contained in:
Jeremy Allison 1998-09-28 21:43:48 +00:00
parent cdaa53e3ef
commit cf3a9741dc
38 changed files with 1150 additions and 787 deletions

View File

@ -92,7 +92,7 @@ extern BOOL tar_reset;
/* clitar bits end */
int myumask = 0755;
mode_t myumask = 0755;
extern pstring scope;
@ -840,22 +840,22 @@ static BOOL do_this_one(file_info *finfo)
*****************************************************************************/
static char *fix_char_ptr(unsigned int datap, unsigned int converter, char *rdata, int rdrcnt)
{
if( datap == 0 ) /* turn NULL pointers */
if( datap == 0 ) /* turn NULL pointers */
{ /* into zero length strings */
return "";
return "";
}
else
else
{
unsigned int offset = datap - converter;
unsigned int offset = datap - converter;
if( offset >= rdrcnt )
if( offset >= rdrcnt )
{
DEBUG(1,("bad char ptr: datap=%u, converter=%u, rdata=%lu, rdrcnt=%d>", datap, converter, (unsigned long)rdata, rdrcnt));
return "<ERROR>";
return "<ERROR>";
}
else
else
{
return &rdata[offset];
return &rdata[offset];
}
}
}
@ -2407,8 +2407,8 @@ static void cmd_print(char *inbuf,char *outbuf )
}
/****************************************************************************
show a print queue - this is deprecated as it uses the old smb that
has limited support - the correct call is the cmd_p_queue_4() after this.
show a print queue - this is deprecated as it uses the old smb that
has limited support - the correct call is the cmd_p_queue_4() after this.
****************************************************************************/
static void cmd_queue(char *inbuf,char *outbuf )
{
@ -3379,7 +3379,6 @@ wait for keyboard activity, swallowing network packets
static void wait_keyboard(char *buffer)
{
fd_set fds;
int selrtn;
struct timeval timeout;
while (1)
@ -3391,7 +3390,7 @@ static void wait_keyboard(char *buffer)
timeout.tv_sec = 20;
timeout.tv_usec = 0;
selrtn = sys_select(MAX(Client,fileno(stdin))+1,&fds,&timeout);
sys_select(MAX(Client,fileno(stdin))+1,&fds,&timeout);
if (FD_ISSET(fileno(stdin),&fds))
return;

View File

@ -430,7 +430,7 @@ static void dozerobuf(int f, int n)
/****************************************************************************
Malloc tape buffer
****************************************************************************/
static void initarbuf()
static void initarbuf(void)
{
/* initialize tar buffer */
tbufsiz=blocksize*TBLOCK;

1563
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -292,18 +292,19 @@ if test x"$samba_cv_HAVE_KERNEL_OPLOCKS" = x"yes"; then
fi
AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/capability.h>],
[cap_t cap;
AC_TRY_RUN([#include <sys/types.h>
#include <sys/capability.h>
main() {
cap_t cap;
if ((cap = cap_get_proc()) == NULL)
exit(1);
cap->cap_effective |= CAP_NETWORK_MGT;
cap->cap_inheritable |= CAP_NETWORK_MGT;
if (cap_set_proc(cap) == -1)
exit(1);
cap_set_proc(cap);
exit(0);
}
],
samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no)])
samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
fi

View File

@ -28,6 +28,34 @@
* These definitions depend on smb.h
*/
typedef struct
{
SMB_OFF_T size;
int mode;
uid_t uid;
gid_t gid;
/* these times are normally kept in GMT */
time_t mtime;
time_t atime;
time_t ctime;
pstring name;
} file_info;
struct pwd_info
{
BOOL null_pwd;
BOOL cleartext;
BOOL crypted;
fstring password;
uchar smb_lm_pwd[16];
uchar smb_nt_pwd[16];
uchar smb_lm_owf[24];
uchar smb_nt_owf[24];
};
struct cli_state {
int fd;
int cnum;
@ -52,7 +80,7 @@ struct cli_state {
struct in_addr dest_ip;
struct pwd_info pwd;
char cryptkey[8];
unsigned char cryptkey[8];
uint32 sesskey;
int serverzone;
uint32 servertime;

View File

@ -135,7 +135,7 @@ int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask);
/*The following definitions come from lib/pidfile.c */
int pidfile_pid(char *name);
pid_t pidfile_pid(char *name);
void pidfile_create(char *name);
/*The following definitions come from lib/replace.c */
@ -460,11 +460,11 @@ void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
void pwd_set_nullpwd(struct pwd_info *pwd);
void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
void pwd_set_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16]);
void pwd_get_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16]);
void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
void pwd_make_lm_nt_owf(struct pwd_info *pwd, char cryptkey[8]);
void pwd_get_lm_nt_owf(struct pwd_info *pwd, char lm_owf[24], char nt_owf[24]);
void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8]);
void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24]);
/*The following definitions come from libsmb/smbdes.c */
@ -2023,7 +2023,7 @@ void check_kernel_oplocks(void);
/*The following definitions come from smbd/password.c */
void generate_next_challenge(char *challenge);
BOOL set_challenge(char *challenge);
BOOL set_challenge(unsigned char *challenge);
user_struct *get_valid_user_struct(uint16 vuid);
void invalidate_vuid(uint16 vuid);
char *validated_username(uint16 vuid);
@ -2210,7 +2210,7 @@ void start_smbd(void);
void start_nmbd(void);
void stop_smbd(void);
void stop_nmbd(void);
void kill_pid(int pid);
void kill_pid(pid_t pid);
/*The following definitions come from web/statuspage.c */

View File

@ -403,36 +403,6 @@ typedef struct cred_info
UTIME timestamp; /* credential time-stamp */
} DOM_CRED;
struct pwd_info
{
BOOL null_pwd;
BOOL cleartext;
BOOL crypted;
fstring password;
uchar smb_lm_pwd[16];
uchar smb_nt_pwd[16];
uchar smb_lm_owf[24];
uchar smb_nt_owf[24];
};
typedef struct
{
SMB_OFF_T size;
int mode;
uid_t uid;
gid_t gid;
/* these times are normally kept in GMT */
time_t mtime;
time_t atime;
time_t ctime;
pstring name;
} file_info;
/* Structure used when SMBwritebmpx is active */
typedef struct
{
@ -538,7 +508,7 @@ typedef struct files_struct
file_fd_struct *fd_ptr;
SMB_OFF_T pos;
SMB_OFF_T size;
int mode;
mode_t mode;
int vuid;
char *mmap_ptr;
SMB_OFF_T mmap_size;

View File

@ -108,7 +108,9 @@ int DEBUGLEVEL = 1;
static BOOL stdout_logging = False;
static int debug_count = 0;
#ifdef WITH_SYSLOG
static int syslog_level = 0;
#endif
static pstring format_bufr = { '\0' };
static int format_pos = 0;
@ -513,8 +515,10 @@ BOOL dbghdr( int level, char *file, char *func, int line )
return( True );
}
#ifdef WITH_SYSLOG
/* Set syslog_level. */
syslog_level = level;
#endif
/* Don't print a header if we're logging to stdout. */
if( stdout_logging )

View File

@ -19,6 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
void *memcpy (void *, void *, unsigned int);
/* NOTE: This code makes no attempt to be fast!

View File

@ -30,7 +30,7 @@ extern int DEBUGLEVEL;
/* return the pid in a pidfile. return 0 if the process (or pidfile)
does not exist */
int pidfile_pid(char *name)
pid_t pidfile_pid(char *name)
{
FILE *f;
unsigned ret;
@ -51,7 +51,7 @@ int pidfile_pid(char *name)
if (!process_exists(ret)) return 0;
return ret;
return (pid_t)ret;
}
/* create a pid file in the lock directory. open it and leave it locked */

View File

@ -470,7 +470,7 @@ time_t make_unix_date2(void *date_ptr)
******************************************************************/
time_t make_unix_date3(void *date_ptr)
{
time_t t = IVAL(date_ptr,0);
time_t t = (time_t)IVAL(date_ptr,0);
if (!null_mtime(t))
t += LocTimeDiff(t);
return(t);

View File

@ -1926,8 +1926,8 @@ ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned
select always returns true on disk files */
/* Set initial timeout */
timeout.tv_sec = time_out / 1000;
timeout.tv_usec = 1000 * (time_out % 1000);
timeout.tv_sec = (time_t)(time_out / 1000);
timeout.tv_usec = (long)(1000 * (time_out % 1000));
for (nread=0; nread < mincnt; )
{

View File

@ -1879,7 +1879,7 @@ BOOL cli_establish_connection(struct cli_state *cli,
/* attempt encrypted session */
if (!cli_session_setup(cli, cli->user_name,
(char*)lm_sess_pwd, sizeof(lm_sess_pwd),
nt_sess_pwd, sizeof(nt_sess_pwd),
(char*)nt_sess_pwd, sizeof(nt_sess_pwd),
cli->domain))
{
DEBUG(1,("failed session setup\n"));

View File

@ -102,8 +102,8 @@ BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
bzero((char *)&p,sizeof(p));
if (!name_trn_id) name_trn_id = (time(NULL)%(unsigned)0x7FFF) +
(getpid()%(unsigned)100);
if (!name_trn_id) name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) +
((unsigned)getpid()%(unsigned)100);
name_trn_id = (name_trn_id+1) % (unsigned)0x7FFF;
nmb->header.name_trn_id = name_trn_id;
@ -210,8 +210,8 @@ struct in_addr *name_query(int fd,char *name,int name_type, BOOL bcast,BOOL recu
bzero((char *)&p,sizeof(p));
(*count) = 0;
if (!name_trn_id) name_trn_id = (time(NULL)%(unsigned)0x7FFF) +
(getpid()%(unsigned)100);
if (!name_trn_id) name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) +
((unsigned)getpid()%(unsigned)100);
name_trn_id = (name_trn_id+1) % (unsigned)0x7FFF;
nmb->header.name_trn_id = name_trn_id;

View File

@ -133,7 +133,7 @@ void pwd_get_cleartext(struct pwd_info *pwd, char *clr)
/****************************************************************************
stores lm and nt hashed passwords
****************************************************************************/
void pwd_set_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16])
void pwd_set_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16])
{
pwd_init(pwd);
@ -165,7 +165,7 @@ void pwd_set_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16])
/****************************************************************************
gets lm and nt hashed passwords
****************************************************************************/
void pwd_get_lm_nt_16(struct pwd_info *pwd, char lm_pwd[16], char nt_pwd[16])
void pwd_get_lm_nt_16(struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16])
{
pwd_deobfuscate(pwd);
memcpy(lm_pwd, pwd->smb_lm_pwd, 16);
@ -191,7 +191,7 @@ void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr)
/****************************************************************************
makes lm and nt OWF crypts
****************************************************************************/
void pwd_make_lm_nt_owf(struct pwd_info *pwd, char cryptkey[8])
void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8])
{
pwd_deobfuscate(pwd);
@ -226,11 +226,10 @@ void pwd_make_lm_nt_owf(struct pwd_info *pwd, char cryptkey[8])
/****************************************************************************
gets lm and nt crypts
****************************************************************************/
void pwd_get_lm_nt_owf(struct pwd_info *pwd, char lm_owf[24], char nt_owf[24])
void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24])
{
pwd_deobfuscate(pwd);
memcpy(lm_owf, pwd->smb_lm_owf, 24);
memcpy(nt_owf, pwd->smb_nt_owf, 24);
pwd_obfuscate(pwd);
}

View File

@ -398,7 +398,6 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16
int *mode_array;
unsigned int hash_entry;
share_mode_record *file_scanner_p;
share_mode_record *file_prev_p;
shm_share_mode_entry *new_entry_p;
int new_entry_offset;
BOOL found = False;
@ -411,7 +410,6 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16
mode_array = (int *)shmops->offset2addr(shmops->get_userdef_off());
file_scanner_p = (share_mode_record *)shmops->offset2addr(mode_array[hash_entry]);
file_prev_p = file_scanner_p;
while(file_scanner_p)
{
@ -422,7 +420,6 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16
}
else
{
file_prev_p = file_scanner_p ;
file_scanner_p = (share_mode_record *)
shmops->offset2addr(file_scanner_p->next_offset);
}
@ -509,7 +506,6 @@ static BOOL shm_remove_share_oplock(files_struct *fsp, int token)
share_mode_record *file_scanner_p;
share_mode_record *file_prev_p;
shm_share_mode_entry *entry_scanner_p;
shm_share_mode_entry *entry_prev_p;
BOOL found = False;
int pid = getpid();
@ -568,7 +564,6 @@ static BOOL shm_remove_share_oplock(files_struct *fsp, int token)
found = False;
entry_scanner_p = (shm_share_mode_entry*)shmops->offset2addr(
file_scanner_p->share_mode_entries);
entry_prev_p = entry_scanner_p;
while(entry_scanner_p)
{
if( (pid == entry_scanner_p->e.pid) &&
@ -584,7 +579,6 @@ static BOOL shm_remove_share_oplock(files_struct *fsp, int token)
}
else
{
entry_prev_p = entry_scanner_p;
entry_scanner_p = (shm_share_mode_entry *)
shmops->offset2addr(entry_scanner_p->next_share_mode_entry);
}

View File

@ -384,7 +384,6 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid)
int nb_read;
pid_t other_pid;
SMB_OFF_T seek_back = -((SMB_OFF_T)sizeof(other_pid));
SMB_OFF_T erased_slot;
BOOL found = False;
@ -404,7 +403,12 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid)
DEBUG(5,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %.0f)\n",
(int)other_pid, (double)seek_back));
other_pid = (pid_t)0;
erased_slot = sys_lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
if(sys_lseek(smb_shm_processes_fd, seek_back, SEEK_CUR) == -1)
{
DEBUG(0,("ERROR smb_shm_unregister_process : processreg_file sys_lseek failed with code %s\n",strerror(errno)));
close(smb_shm_processes_fd);
return False;
}
if(write(smb_shm_processes_fd, &other_pid, sizeof(other_pid)) < 0)
{
DEBUG(0,("ERROR smb_shm_unregister_process : processreg_file write failed with code %s\n",strerror(errno)));

View File

@ -92,7 +92,6 @@ struct ShmBlockDesc
#define AlignedHeaderSize ((sizeof(struct ShmHeader)+7) & ~7)
static struct ShmHeader *shm_header_p = NULL;
static BOOL shm_initialize_called = False;
static int read_only;
@ -447,8 +446,6 @@ static BOOL shm_initialize(int size)
shm_header_p->consistent = True;
shm_initialize_called = True;
return True;
}
@ -533,7 +530,6 @@ static struct shmem_ops shmops = {
******************************************************************/
struct shmem_ops *sysv_shm_open(int ronly)
{
BOOL created_new = False;
BOOL other_processes;
struct shmid_ds shm_ds;
struct semid_ds sem_ds;
@ -661,7 +657,6 @@ struct shmem_ops *sysv_shm_open(int ronly)
(errno != EINVAL && errno != ENOSPC)) break;
shm_size *= 0.8;
}
created_new = (shm_id != -1);
}
if (shm_id == -1) {

View File

@ -280,7 +280,6 @@ static void release_msbrowse_name_fail( struct subnet_record *subrec,
void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
BOOL force_new_election)
{
struct server_record *servrec;
struct name_record *namerec;
struct nmb_name nmbname;
@ -289,7 +288,7 @@ void unbecome_local_master_browser(struct subnet_record *subrec, struct work_rec
DEBUG(2,("unbecome_local_master_browser: unbecoming local master for workgroup %s \
on subnet %s\n",work->work_group, subrec->subnet_name));
if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
if(find_server_in_workgroup( work, global_myname) == NULL)
{
DEBUG(0,("unbecome_local_master_browser: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
@ -489,7 +488,6 @@ static void become_local_master_fail1(struct subnet_record *subrec,
{
char *work_name = rrec->userdata->data;
struct work_record *work = find_workgroup_on_subnet(subrec, work_name);
struct server_record *servrec;
if(!work)
{
@ -498,7 +496,7 @@ workgroup %s on subnet %s\n", work_name, subrec->subnet_name));
return;
}
if((servrec = find_server_in_workgroup(work, global_myname)) == NULL)
if(find_server_in_workgroup(work, global_myname) == NULL)
{
DEBUG(0,("become_local_master_fail1: Error - cannot find server %s \
in workgroup %s on subnet %s\n",
@ -524,7 +522,6 @@ workgroup %s on subnet %s. Couldn't register name %s.\n",
void become_local_master_browser(struct subnet_record *subrec, struct work_record *work)
{
struct server_record *servrec;
struct userdata_struct *userdata;
int size = sizeof(struct userdata_struct) + sizeof(fstring) + 1;
@ -542,7 +539,7 @@ void become_local_master_browser(struct subnet_record *subrec, struct work_recor
return;
}
if((servrec = find_server_in_workgroup( work, global_myname)) == NULL)
if(find_server_in_workgroup( work, global_myname) == NULL)
{
DEBUG(0,("become_local_master_browser: Error - cannot find server %s \
in workgroup %s on subnet %s\n",

View File

@ -544,7 +544,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
int port)
{
char outbuf[1024];
char *p, *countptr, *nameptr;
char *p, *countptr;
unsigned int count = 0;
int len;
struct server_record *servrec;
@ -565,8 +565,6 @@ static void send_backup_list_response(struct subnet_record *subrec,
SIVAL(p,0,token); /* The sender's unique info. */
p += 4;
nameptr = p;
/* We always return at least one name - our own. */
count = 1;
StrnCpy(p,global_myname,15);
@ -793,7 +791,6 @@ void process_announce_request(struct subnet_record *subrec, struct packet_struct
void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf)
{
struct dgram_packet *dgram = &p->packet.dgram;
struct work_record *work;
char *workgroup_name = dgram->dest_name.name;
DEBUG(3,("process_lm_announce_request: Announce request from %s IP %s to %s.\n",
@ -808,7 +805,7 @@ void process_lm_announce_request(struct subnet_record *subrec, struct packet_str
return;
}
if((work = find_workgroup_on_subnet(subrec, workgroup_name)) == NULL)
if(find_workgroup_on_subnet(subrec, workgroup_name) == NULL)
{
DEBUG(0,("process_announce_request: Unable to find workgroup %s on subnet !\n",
workgroup_name));

View File

@ -138,7 +138,7 @@ static uint16 generate_name_trn_id(void)
if (!name_trn_id)
{
name_trn_id = (time(NULL)%(unsigned)0x7FFF) + (getpid()%(unsigned)100);
name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)getpid()%(unsigned)100);
}
name_trn_id = (name_trn_id+1) % (unsigned)0x7FFF;
return name_trn_id;

View File

@ -41,20 +41,14 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len,
struct dgram_packet *dgram = &p->packet.dgram;
pstring my_name;
fstring reply_name;
BOOL add_slashes = False;
pstring outbuf;
int code,reply_code;
char unknown_byte = 0;
uint16 request_count = 0;
int code;
uint16 token = 0;
uint32 ntversion;
uint16 lmnttoken;
uint16 lm20token;
uint32 allowableaccount; /* Control bits, i.e. 0x80 == workstation trust a/c. */
uint32 domainsidsize;
uint16 requestcount;
char *domainsid;
char *getdc;
char *uniuser; /* Unicode user name. */
pstring ascuser;
@ -84,13 +78,9 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
getdc = skip_string(user,1);
q = skip_string(getdc,1);
unknown_byte = CVAL(q,0);
request_count = SVAL(q,1);
token = SVAL(q,3);
reply_code = 0x6;
fstrcpy(reply_name,my_name);
add_slashes = True;
DEBUG(3,("process_logon_packet: Domain login request from %s at IP %s user=%s token=%x\n",
machine,inet_ntoa(p->ip),user,token));
@ -175,14 +165,11 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
{
char *q = buf + 2;
requestcount = SVAL(q, 0); q += 2;
unicomp = q;
uniuser = skip_unicode_string(unicomp,1);
getdc = skip_unicode_string(uniuser,1);
q = skip_string(getdc,1);
allowableaccount = IVAL(q, 0); q += 4;
domainsidsize = IVAL(q, 0); q += 4;
domainsid = q;
q += domainsidsize + 3;
ntversion = IVAL(q, 0); q += 4;
lmnttoken = SVAL(q, 0); q += 2;

View File

@ -230,14 +230,13 @@ static uint32 write_this_server_name( struct subnet_record *subrec,
{
struct subnet_record *ssub;
struct work_record *iwork;
struct server_record *sserv;
/* Go through all the subnets we have already seen. */
for (ssub = FIRST_SUBNET; ssub != subrec; ssub = NEXT_SUBNET_INCLUDING_UNICAST(ssub))
{
for(iwork = ssub->workgrouplist; iwork; iwork = iwork->next)
{
if((sserv = find_server_in_workgroup( iwork, servrec->serv.name)) != NULL)
if(find_server_in_workgroup( iwork, servrec->serv.name) != NULL)
{
/*
* We have already written out this server record, don't

View File

@ -173,7 +173,6 @@ BOOL initialise_wins(void)
int type = 0;
int nb_flags;
int ttl;
enum name_source source;
char *ptr;
char *p;
BOOL got_token;
@ -266,8 +265,6 @@ BOOL initialise_wins(void)
{
next_token(&ptr, ip_str, NULL, sizeof(ip_str));
ip_list[i] = *interpret_addr2(ip_str);
if (ip_equal(ip_list[i], ipzero))
source = SELF_NAME;
}
next_token(&ptr,nb_flags_str,NULL, sizeof(nb_flags_str));
@ -538,18 +535,10 @@ static void wins_register_query_fail(struct subnet_record *subrec,
{
struct userdata_struct *userdata = rrec->userdata;
struct packet_struct *orig_reg_packet;
struct nmb_packet *nmb;
struct name_record *namerec = NULL;
uint16 nb_flags;
BOOL group;
memcpy((char *)&orig_reg_packet, userdata->data, sizeof(struct packet_struct *));
nmb = &orig_reg_packet->packet.nmb;
nb_flags = get_nb_flags(nmb->additional->rdata);
group = (nb_flags & NB_GROUP) ? True : False;
/*
* We want to just add the name, as we now know the original owner
* didn't want it. But we can't just do that as an arbitary
@ -1547,7 +1536,6 @@ void wins_write_database(BOOL background)
{
struct name_record *namerec;
pstring fname, fnamenew;
static int child_pid;
FILE *fp;
@ -1558,7 +1546,7 @@ void wins_write_database(BOOL background)
doesn't block while this is done */
if (background) {
CatchChild();
if ((child_pid=fork())) {
if (fork()) {
return;
}
}

View File

@ -96,7 +96,7 @@ static struct smb_passwd *getsmbfilepwent(void *vp)
unsigned char c;
unsigned char *p;
long uidval;
long linebuf_len;
size_t linebuf_len;
if(fp == NULL) {
DEBUG(0,("getsmbfilepwent: Bad password file pointer.\n"));
@ -566,7 +566,7 @@ static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
fstring ascii_p16;
fstring encode_bits;
unsigned char *p = NULL;
long linebuf_len = 0;
size_t linebuf_len = 0;
FILE *fp;
int lockfd;
char *pfile = lp_smb_passwd_file();

View File

@ -151,12 +151,11 @@ static void samr_reply_open_domain(SAMR_Q_OPEN_DOMAIN *q_u,
{
SAMR_R_OPEN_DOMAIN r_u;
BOOL pol_open = False;
int pol_idx;
r_u.status = 0x0;
/* find the connection policy handle. */
if (r_u.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->connect_pol))) == -1))
if (r_u.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->connect_pol)) == -1))
{
r_u.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -211,14 +210,13 @@ static void samr_reply_unknown_3(SAMR_Q_UNKNOWN_3 *q_u,
{
SAMR_R_UNKNOWN_3 r_u;
DOM_SID3 sid[MAX_SAM_SIDS];
int pol_idx;
uint32 rid;
uint32 status;
status = 0x0;
/* find the policy handle. open a policy on it. */
if (status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->user_pol))) == -1))
if (status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->user_pol)) == -1))
{
status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -290,14 +288,12 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u,
SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES];
int num_entries;
int total_entries;
int pol_idx;
BOOL got_pwds;
r_e.status = 0x0;
r_e.total_num_entries = 0;
/* find the policy handle. open a policy on it. */
if (r_e.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
r_e.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -305,7 +301,7 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u,
DEBUG(5,("samr_reply_enum_dom_users: %d\n", __LINE__));
become_root(True);
got_pwds = get_sampwd_entries(pass, &total_entries, &num_entries, MAX_SAM_ENTRIES, q_u->acb_mask);
get_sampwd_entries(pass, &total_entries, &num_entries, MAX_SAM_ENTRIES, q_u->acb_mask);
unbecome_root(True);
make_samr_r_enum_dom_users(&r_e, total_entries,
@ -343,7 +339,6 @@ static void samr_reply_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_u,
SAMR_R_ENUM_DOM_GROUPS r_e;
SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES];
int num_entries;
int pol_idx;
BOOL got_grps;
char *dummy_group = "Domain Admins";
@ -351,7 +346,7 @@ static void samr_reply_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_u,
r_e.num_entries = 0;
/* find the policy handle. open a policy on it. */
if (r_e.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
r_e.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -399,7 +394,6 @@ static void samr_reply_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_u,
SAMR_R_ENUM_DOM_ALIASES r_e;
SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES];
int num_entries;
int pol_idx;
BOOL got_aliases;
char *dummy_alias = "admins";
@ -407,7 +401,7 @@ static void samr_reply_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_u,
r_e.num_entries = 0;
/* find the policy handle. open a policy on it. */
if (r_e.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
r_e.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -459,14 +453,13 @@ static void samr_reply_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_u,
SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES];
int num_entries;
int total_entries;
int pol_idx;
BOOL got_pwds;
uint16 switch_level = 0x0;
r_e.status = 0x0;
/* find the policy handle. open a policy on it. */
if (r_e.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
r_e.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -538,14 +531,12 @@ static void samr_reply_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_u,
prs_struct *rdata)
{
SAMR_R_QUERY_ALIASINFO r_e;
int pol_idx;
BOOL got_alias;
r_e.status = 0x0;
r_e.ptr = 0;
/* find the policy handle. open a policy on it. */
if (r_e.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (r_e.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
r_e.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -560,11 +551,6 @@ static void samr_reply_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_u,
}
}
if (r_e.status == 0x0)
{
got_alias = True;
}
make_samr_r_query_aliasinfo(&r_e, q_u->switch_level,
"<account description>",
r_e.status);
@ -737,14 +723,13 @@ static void samr_reply_unknown_12(SAMR_Q_UNKNOWN_12 *q_u,
uint32 group_attrs[MAX_SAM_ENTRIES];
uint32 status = 0;
int num_gids = q_u->num_gids1;
uint32 pol_idx;
SAMR_R_UNKNOWN_12 r_u;
DEBUG(5,("samr_unknown_12: %d\n", __LINE__));
/* find the policy handle. open a policy on it. */
if (status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -798,7 +783,6 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
{
SAMR_R_OPEN_USER r_u;
struct sam_passwd *sam_pass;
int pol_idx;
BOOL pol_open = False;
/* set up the SAMR open_user response */
@ -807,7 +791,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
r_u.status = 0x0;
/* find the policy handle. open a policy on it. */
if (r_u.status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->domain_pol))) == -1))
if (r_u.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->domain_pol)) == -1))
{
r_u.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}
@ -955,12 +939,11 @@ static void samr_reply_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u,
uint32 status = 0x0;
uint32 rid = 0x0;
int obj_idx;
DEBUG(5,("samr_reply_query_userinfo: %d\n", __LINE__));
/* search for the handle */
if (status == 0x0 && (obj_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1)
if (status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
status = NT_STATUS_INVALID_HANDLE;
}
@ -1045,13 +1028,12 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
struct sam_passwd *sam_pass;
DOM_GID *gids = NULL;
int num_groups = 0;
int pol_idx;
uint32 rid;
DEBUG(5,("samr_query_usergroups: %d\n", __LINE__));
/* find the policy handle. open a policy on it. */
if (status == 0x0 && ((pol_idx = find_lsa_policy_by_hnd(&(q_u->pol))) == -1))
if (status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
{
status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
}

View File

@ -132,22 +132,22 @@ void cmd_sam_enum_users(struct client_info *info)
#ifdef DEBUG_TESTING
if (next_token(NULL, tmp, NULL, sizeof(tmp)))
{
num_entries = strtoul(tmp, (char**)NULL, 16);
num_entries = (uint16)strtoul(tmp, (char**)NULL, 16);
}
if (next_token(NULL, tmp, NULL, sizeof(tmp)))
{
unk_0 = strtoul(tmp, (char**)NULL, 16);
unk_0 = (uint16)strtoul(tmp, (char**)NULL, 16);
}
if (next_token(NULL, tmp, NULL, sizeof(tmp)))
{
acb_mask = strtoul(tmp, (char**)NULL, 16);
acb_mask = (uint16)strtoul(tmp, (char**)NULL, 16);
}
if (next_token(NULL, tmp, NULL, sizeof(tmp)))
{
unk_1 = strtoul(tmp, (char**)NULL, 16);
unk_1 = (uint16)strtoul(tmp, (char**)NULL, 16);
}
#endif

View File

@ -215,7 +215,6 @@ wait for keyboard activity, swallowing network packets
static void wait_keyboard(struct cli_state *cli)
{
fd_set fds;
int selrtn;
struct timeval timeout;
while (1)
@ -226,7 +225,7 @@ static void wait_keyboard(struct cli_state *cli)
timeout.tv_sec = 20;
timeout.tv_usec = 0;
selrtn = sys_select(MAX(cli->fd,fileno(stdin))+1,&fds,&timeout);
sys_select(MAX(cli->fd,fileno(stdin))+1,&fds,&timeout);
if (FD_ISSET(fileno(stdin),&fds))
return;
@ -357,11 +356,10 @@ usage on the program
****************************************************************************/
static void usage(char *pname)
{
fprintf(out_hnd, "Usage: %s service <password> [-p port] [-d debuglevel] [-l log] ",
fprintf(out_hnd, "Usage: %s service <password> [-d debuglevel] [-l log] ",
pname);
fprintf(out_hnd, "\nVersion %s\n",VERSION);
fprintf(out_hnd, "\t-p port connect to the specified port\n");
fprintf(out_hnd, "\t-d debuglevel set the debuglevel\n");
fprintf(out_hnd, "\t-l log basename. Basename for log/debug files\n");
fprintf(out_hnd, "\t-n netbios name. Use this name as my netbios name\n");
@ -389,7 +387,6 @@ enum client_action
int main(int argc,char *argv[])
{
char *pname = argv[0];
int port = SMB_PORT;
int opt;
extern FILE *dbf;
extern char *optarg;
@ -399,9 +396,8 @@ enum client_action
char *p;
BOOL got_pass = False;
char *cmd_str="";
int myumask = 0755;
mode_t myumask = 0755;
enum client_action cli_action = CLIENT_NONE;
int ret = 0;
struct client_info cli_info;
@ -540,7 +536,7 @@ enum client_action
cli_action = CLIENT_SVC;
}
while ((opt = getopt(argc, argv,"s:B:O:M:S:i:N:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
while ((opt = getopt(argc, argv,"s:B:O:M:S:i:N:d:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
{
switch (opt)
{
@ -638,12 +634,6 @@ enum client_action
break;
}
case 'p':
{
port = atoi(optarg);
break;
}
case 'c':
{
cmd_str = optarg;
@ -745,20 +735,17 @@ enum client_action
exit(-1);
}
ret = 0;
switch (cli_action)
{
case CLIENT_IPC:
{
ret = process(&cli_info, cmd_str) ? 0 : 1;
process(&cli_info, cmd_str) ? 0 : 1;
break;
}
default:
{
fprintf(stderr, "unknown client action requested\n");
ret = 1;
break;
}
}

View File

@ -80,8 +80,26 @@ END {
next;
}
!/^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ {
next;
#
# We have to split up the start
# matching as we now have so many start
# types that it can cause some versions
# of nawk/awk to choke and fail on
# the full match. JRA.
#
{
gotstart = 0;
if( $0 ~ /^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^pid_t/ ) {
gotstart = 1;
}
if( $0 ~ /^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
gotstart = 1;
}
if(!gotstart) {
next;
}
}

View File

@ -428,7 +428,6 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,
pstring pathreal;
BOOL isrootdir;
pstring filename;
BOOL matched;
BOOL needslash;
*path = *pathreal = *filename = 0;
@ -453,8 +452,6 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,
if (dname == NULL)
return(False);
matched = False;
pstrcpy(filename,dname);
if ((strcmp(filename,mask) == 0) ||

View File

@ -332,7 +332,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
BOOL *bad_path, SMB_STRUCT_STAT *pst)
{
SMB_STRUCT_STAT st;
char *start, *end, *orig_start;
char *start, *end;
pstring dirpath;
pstring orig_path;
int saved_errno;
@ -366,17 +366,6 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
trim_string(name,"/","/");
/*
* If we trimmed down to a single '\0' character
* then we should use the "." directory to avoid
* searching the cache.
*/
if(!*name) {
name[0] = '.';
name[1] = '\0';
}
/*
* Ensure saved_last_component is valid even if file exists.
*/
@ -413,6 +402,15 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
return(True);
}
/*
* If we trimmed down to a single '\0' character
* then we will be using the "." directory.
* As we know this is valid we can return true here.
*/
if(!*name)
return(True);
start = name;
while (strncmp(start,"./",2) == 0)
start += 2;
@ -479,7 +477,7 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
* as is first, then trying to scan the directory for matching names.
*/
for (orig_start = start; start ; start = (end?end+1:(char *)NULL)) {
for (; start ; start = (end?end+1:(char *)NULL)) {
/*
* Pinpoint the end of this section of the filename.
*/

View File

@ -420,8 +420,8 @@ should be %d).\n", msg_len, OPLOCK_BREAK_MSG_LEN));
dev = IVAL(msg_start,OPLOCK_BREAK_DEV_OFFSET);
tval.tv_sec = IVAL(msg_start, OPLOCK_BREAK_SEC_OFFSET);
tval.tv_usec = IVAL(msg_start, OPLOCK_BREAK_USEC_OFFSET);
tval.tv_sec = (time_t)IVAL(msg_start, OPLOCK_BREAK_SEC_OFFSET);
tval.tv_usec = (long)IVAL(msg_start, OPLOCK_BREAK_USEC_OFFSET);
ptval = &tval;

View File

@ -75,7 +75,7 @@ void generate_next_challenge(char *challenge)
/*******************************************************************
set the last challenge sent, usually from a password server
********************************************************************/
BOOL set_challenge(char *challenge)
BOOL set_challenge(unsigned char *challenge)
{
memcpy(saved_challenge,challenge,8);
challenge_sent = True;

View File

@ -357,14 +357,12 @@ static void scan_copyfiles(FILE *fichier, char *chaine)
static void scan_short_desc(FILE *fichier, char *short_desc)
{
int i=0;
char *chaine;
char *temp;
char *copyfiles=0,*datasection=0;
helpfile=0;
languagemonitor=0;
datatype="RAW";
chaine=(char *)malloc(sizeof(pstring));
temp=(char *)malloc(sizeof(pstring));
driverfile=short_desc;

View File

@ -185,7 +185,7 @@ int main(int argc,char *argv[])
for (i=optind;i<argc;i++)
{
int j, count, retries = 2;
int j, count;
char *p;
struct in_addr ip;
struct in_addr *ip_list;
@ -214,9 +214,8 @@ int main(int argc,char *argv[])
p = strchr(lookup,'#');
if (p) {
*p = 0;
sscanf(p+1,"%x",&lookup_type);
retries = 1;
*p = 0;
sscanf(p+1,"%x",&lookup_type);
}
if ((ip_list = name_query(ServerFD,lookup,lookup_type,use_bcast,recursion_desired,

View File

@ -143,7 +143,7 @@ static void print_share_mode(share_mode_entry *e, char *fname)
{
FILE *f;
pstring fname;
int uid, c;
int c;
static pstring servicesf = CONFIGFILE;
extern char *optarg;
int verbose = 0, brief =0;
@ -222,8 +222,6 @@ static void print_share_mode(share_mode_entry *e, char *fname)
printf("Opened status file %s\n", fname);
}
uid = getuid();
if (!locks_only) {
if (!processes_only) {

View File

@ -41,7 +41,6 @@ static struct var variables[MAX_VARIABLES];
static int num_variables;
static int content_length;
static int request_post;
static int request_get;
static char *query_string;
static char *baseurl;
static char *pathinfo;
@ -410,7 +409,6 @@ void cgi_setup(char *rootdir, int auth_required)
#endif
if (line[0] == '\r' || line[0] == '\n') break;
if (strncasecmp(line,"GET ", 4)==0) {
request_get = 1;
url = strdup(&line[4]);
} else if (strncasecmp(line,"POST ", 5)==0) {
request_post = 1;

View File

@ -71,7 +71,7 @@ void start_nmbd(void)
/* stop smbd */
void stop_smbd(void)
{
unsigned pid = pidfile_pid("smbd");
pid_t pid = pidfile_pid("smbd");
if (geteuid() != 0) return;
@ -83,7 +83,7 @@ void stop_smbd(void)
/* stop nmbd */
void stop_nmbd(void)
{
unsigned pid = pidfile_pid("nmbd");
pid_t pid = pidfile_pid("nmbd");
if (geteuid() != 0) return;
@ -93,7 +93,7 @@ void stop_nmbd(void)
}
/* kill a specified process */
void kill_pid(int pid)
void kill_pid(pid_t pid)
{
if (geteuid() != 0) return;