This pulls is what I considered safe fixes from SAMBA_3_0.
This boiled down to either Klocwork fixes or obvious compiler
warning fixes. I did not include any changes to fnuction
signatures not the version change to the passdb API.
Also pulled in the 3 nmbd fixes requested by Jeremy
and the wildcard delete fix.
This code will sit for a few days in the cooker and then
become 3.0.23 if nothing blows up. I don't care how many
more compile warning fixes people throw into SAMBA_3_0.
'base|b=s' => \$opt_base,
'D|DN=s' => \$opt_binddn,
'debug=i' => \$opt_debug,
- 'extendeddn|e' => \$opt_display_extendeddn,
+ 'extendeddn|e=i' => \$opt_display_extendeddn,
'help' => \$opt_help,
'host|h=s' => \$opt_host,
'machine|P' => \$opt_machine,
>
);
- my $ctl_extended_dn_val = $asn_extended_dn->encode( mode => '1');
- my $ctl_extended_dn =Net::LDAP::Control->new(
- type => $ads_controls{'LDAP_SERVER_EXTENDED_DN_OID'},
- critical => 'true',
- value => $ctl_extended_dn_val);
-
+ # only w2k3 accepts '1' and needs the ctl_val, w2k does not accept a ctl_val
+ my $ctl_extended_dn_val = $asn_extended_dn->encode( mode => $opt_display_extendeddn);
+ my $ctl_extended_dn = Net::LDAP::Control->new(
+ type => $ads_controls{'LDAP_SERVER_EXTENDED_DN_OID'},
+ critical => 'true',
+ value => $opt_display_extendeddn ? $ctl_extended_dn_val : "");
# setup notify control
my $ctl_notification = Net::LDAP::Control->new(
push(@ctrls_s, "LDAP_PAGED_RESULT_OID_STRING" );
}
- if ($opt_display_extendeddn) {
+ if (defined($opt_display_extendeddn)) {
push(@ctrls, $ctl_extended_dn);
push(@ctrls_s, "LDAP_SERVER_EXTENDED_DN_OID");
}
stop() {
KIND="SMB"
echo -n $"Shutting down $KIND services: "
- killproc smbd -TERM
+ killproc smbd
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/run/smbd.pid
echo
KIND="NMB"
if [ x"$ISNETBIOSDISABLED" != x"Yes" ]; then
echo -n $"Shutting down $KIND services: "
- killproc nmbd -TERM
+ killproc nmbd
RETVAL2=$?
[ $RETVAL2 -eq 0 ] && rm -f /var/run/nmbd.pid
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
echo
KIND="Winbind"
echo -n $"Shutting down $KIND services: "
- killproc winbindd -TERM
+ killproc winbindd
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/run/winbindd.pid && rm -f /var/lock/subsys/winbindd
echo ""
stop)
echo -n "Shutting down SMB services: "
- ## we have to get all the smbd process here instead of just the
- ## main parent (i.e. killproc) because it can take a long time
- ## for an individual process to process a TERM signal
- smbdpids=`ps guax | grep smbd | grep -v grep | awk '{print $2}'`
- for pid in $smbdpids; do
- kill -TERM $pid
- done
- ## nmbd is ok to kill using killproc()
- killproc nmbd -TERM
+ killproc smbd
+ killproc nmbd
rm -f /var/lock/subsys/smb
echo ""
;;
(*auth_ntlmssp_state)->ntlmssp_state->may_set_challenge = auth_ntlmssp_may_set_challenge;
(*auth_ntlmssp_state)->ntlmssp_state->set_challenge = auth_ntlmssp_set_challenge;
(*auth_ntlmssp_state)->ntlmssp_state->check_password = auth_ntlmssp_check_password;
- (*auth_ntlmssp_state)->ntlmssp_state->server_role = lp_server_role();
+ (*auth_ntlmssp_state)->ntlmssp_state->server_role = (enum server_types)lp_server_role();
return NT_STATUS_OK;
}
}
break;
case 'E':
+ if (dbf) {
+ x_fclose(dbf);
+ }
dbf = x_stderr;
display_set_stderr();
break;
}
break;
case 'E':
+ if (dbf) {
+ x_fclose(dbf);
+ }
dbf = x_stderr;
display_set_stderr();
break;
struct cli_state *cli; /* SMB interface */
char null_str[1];
int tries = 0;
+ const char *dev_uri;
null_str[0] = '\0';
* Find the URI...
*/
- if (getenv("DEVICE_URI") != NULL)
- strncpy(uri, getenv("DEVICE_URI"), sizeof(uri) - 1);
+ dev_uri = getenv("DEVICE_URI");
+ if (dev_uri)
+ strncpy(uri, dev_uri, sizeof(uri) - 1);
else if (strncmp(argv[0], "smb://", 6) == 0)
strncpy(uri, argv[0], sizeof(uri) - 1);
else
*/
enum wb_posix_mapping {
+ WB_POSIX_MAP_UNKNOWN = -1,
WB_POSIX_MAP_TEMPLATE = 0,
WB_POSIX_MAP_SFU = 1,
WB_POSIX_MAP_RFC2307 = 2,
* Registry key types
* Most keys are going to be GENERIC -- may need a better name?
* HKPD and HKPT are used by reg_perfcount.c
- * they are special keys that congtain performance data
+ * they are special keys that contain performance data
*/
#define REG_KEY_GENERIC 0
#define REG_KEY_HKPD 1
/*
* container for function pointers to enumeration routines
- * for vitural registry view
+ * for virtual registry view
*/
typedef struct {
enum brl_flavour lock_flav, \
br_off start, br_off size)
+#define LOCKING_FN_CAST() \
+ void (*)(struct share_mode_entry *, const char *, const char *)
+
+#define LOCKING_FN(fn) \
+ void (*fn)(struct share_mode_entry *, const char *, const char *)
+
struct bitmap {
uint32 *b;
unsigned int n;
error:
*len = -1;
+ if (mem_ctx == NULL) {
+ SAFE_FREE(*string);
+ }
*string = NULL;
}
key = talloc(mem_ctx, POLICY_HND);
if(!key) {
hnd->status = NT_STATUS_NO_MEMORY;
+ return CAC_FAILURE;
}
err = rpccli_reg_connect( pipe_hnd, mem_ctx, op->in.root, op->in.access, key);
unix_to_nt_time(&pass_must_change_time, info->pass_must_change_time);
/*initialize the strings*/
- init_unistr2(&user_name, info->username, STR_TERMINATE);
- init_unistr2(&full_name, info->full_name, STR_TERMINATE);
- init_unistr2(&home_dir, info->home_dir, STR_TERMINATE);
- init_unistr2(&dir_drive, info->home_drive, STR_TERMINATE);
- init_unistr2(&log_scr, info->logon_script, STR_TERMINATE);
- init_unistr2(&prof_path, info->profile_path, STR_TERMINATE);
- init_unistr2(&desc, info->description, STR_TERMINATE);
- init_unistr2(&wkstas, info->workstations, STR_TERMINATE);
- init_unistr2(&unk, "\0", STR_TERMINATE);
- init_unistr2(&mung_dial, info->dial, STR_TERMINATE);
+ init_unistr2(&user_name, info->username, UNI_STR_TERMINATE);
+ init_unistr2(&full_name, info->full_name, UNI_STR_TERMINATE);
+ init_unistr2(&home_dir, info->home_dir, UNI_STR_TERMINATE);
+ init_unistr2(&dir_drive, info->home_drive, UNI_STR_TERMINATE);
+ init_unistr2(&log_scr, info->logon_script, UNI_STR_TERMINATE);
+ init_unistr2(&prof_path, info->profile_path, UNI_STR_TERMINATE);
+ init_unistr2(&desc, info->description, UNI_STR_TERMINATE);
+ init_unistr2(&wkstas, info->workstations, UNI_STR_TERMINATE);
+ init_unistr2(&unk, "\0", UNI_STR_TERMINATE);
+ init_unistr2(&mung_dial, info->dial, UNI_STR_TERMINATE);
/*manually set passmustchange*/
ctr->info.id21->passmustchange = (info->pass_must_change) ? 0x01 : 0x00;
BOOL First = True;
int ff_searchcount=0;
int ff_eos=0;
- int ff_lastname=0;
int ff_dir_handle=0;
int loop_count = 0;
char *rparam=NULL, *rdata=NULL;
ff_dir_handle = SVAL(p,0);
ff_searchcount = SVAL(p,2);
ff_eos = SVAL(p,4);
- ff_lastname = SVAL(p,8);
} else {
ff_searchcount = SVAL(p,0);
ff_eos = SVAL(p,2);
- ff_lastname = SVAL(p,6);
}
if (ff_searchcount == 0) {
+WORDSIZE /* info level */
+WORDSIZE]; /* reserved word */
- char data[1024];
-
/* offset into data of free format strings. Will be updated */
/* by PUTSTRINGP macro and end up with total data length. */
int soffset = RAP_GROUPNAME_LEN + 1 + DWORDSIZE;
+ char *data;
+ size_t data_size;
+
+ /* Allocate data. */
+ data_size = MAX(soffset + strlen(grinfo->comment) + 1, 1024);
+
+ data = SMB_MALLOC(data_size);
+ if (!data) {
+ DEBUG (1, ("Malloc fail\n"));
+ return -1;
+ }
/* now send a SMBtrans command with api WGroupAdd */
DEBUG(4,("NetGroupAdd failed\n"));
}
+ SAFE_FREE(data);
SAFE_FREE(rparam);
SAFE_FREE(rdata);
uint32 saved_seq;
unsigned char calc_md5_mac[16];
unsigned char *server_sent_mac;
- uint mid;
if (!si->doing_signing)
return True;
return False;
}
- mid = SVAL(inbuf, smb_mid);
-
/* We always increment the sequence number. */
data->send_seq_num += 2;
const char *sharepath;
const char *fname;
int i;
- void (*traverse_callback)(struct share_mode_entry *, const char *, const char *) = state;
+ LOCKING_FN(traverse_callback) = (LOCKING_FN_CAST())state;
/* Ensure this is a locking_key record. */
if (kbuf.dsize != sizeof(struct locking_key))
for (n=iface_count() - 1; n >= 0; n--) {
struct interface *iface = get_interface(n);
+ if (!iface) {
+ DEBUG(2,("reload_interfaces: failed to get interface %d\n", n));
+ continue;
+ }
+
/*
* We don't want to add a loopback interface, in case
* someone has added 127.0.0.1 for smbd, nmbd needs to
if( self_only && (name_ret->data.source != SELF_NAME) && (name_ret->data.source != PERMANENT_NAME) ) {
DEBUG( 9, ( "find_name_on_subnet: on subnet %s - self name %s NOT FOUND\n",
subrec->subnet_name, nmb_namestr(nmbname) ) );
- return False;
+ return NULL;
}
DEBUG( 9, ("find_name_on_subnet: on subnet %s - found name %s source=%d\n",
struct work_record *iwork;
/* Go through all the subnets we have already seen. */
- for (ssub = FIRST_SUBNET; ssub != subrec; ssub = NEXT_SUBNET_INCLUDING_UNICAST(ssub)) {
+ for (ssub = FIRST_SUBNET; ssub && (ssub != subrec); ssub = NEXT_SUBNET_INCLUDING_UNICAST(ssub)) {
for(iwork = ssub->workgrouplist; iwork; iwork = iwork->next) {
if(find_server_in_workgroup( iwork, servrec->serv.name) != NULL) {
/*
for (i = 0 ; i < num_interfaces; i++) {
struct interface *iface = get_interface(i);
+ if (!iface) {
+ DEBUG(2,("create_subnets: can't get interface %d.\n", i ));
+ continue;
+ }
+
/*
* We don't want to add a loopback interface, in case
* someone has added 127.0.0.1 for smbd, nmbd needs to
TDB_CONTEXT *wins_tdb;
+/****************************************************************************
+ Delete all the temporary name records on the in-memory linked list.
+*****************************************************************************/
+
+static void wins_delete_all_tmp_in_memory_records(void)
+{
+ struct name_record *nr = NULL;
+ struct name_record *nrnext = NULL;
+
+ /* Delete all temporary name records on the wins subnet linked list. */
+ for( nr = wins_server_subnet->namelist; nr; nr = nrnext) {
+ nrnext = nr->next;
+ DLIST_REMOVE(wins_server_subnet->namelist, nr);
+ SAFE_FREE(nr->data.ip);
+ SAFE_FREE(nr);
+ }
+}
+
/****************************************************************************
Convert a wins.tdb record to a struct name_record. Add in our global_scope().
*****************************************************************************/
if (!namerec) {
return NULL;
}
+ ZERO_STRUCTP(namerec);
namerec->data.ip = SMB_MALLOC_ARRAY(struct in_addr, num_ips);
if (!namerec->data.ip) {
return NULL;
}
+ /* Self names only - these include permanent names. */
+ if( self_only && (namerec->data.source != SELF_NAME) && (namerec->data.source != PERMANENT_NAME) ) {
+ DEBUG( 9, ( "find_name_on_wins_subnet: self name %s NOT FOUND\n", nmb_namestr(nmbname) ) );
+ SAFE_FREE(namerec->data.ip);
+ SAFE_FREE(namerec);
+ return NULL;
+ }
+
/* Search for this name record on the list. Replace it if found. */
for( nr = wins_server_subnet->namelist; nr; nr = nr->next) {
ret = tdb_delete(wins_tdb, key);
DLIST_REMOVE(wins_server_subnet->namelist, namerec);
- SAFE_FREE(namerec->data.ip);
/* namerec must be freed by the caller */
num_ips = 0;
+ /* First, clear the in memory list - we're going to re-populate
+ it with the tdb_traversal in fetch_all_active_wins_1b_names. */
+
+ wins_delete_all_tmp_in_memory_records();
+
fetch_all_active_wins_1b_names();
for( namerec = subrec->namelist; namerec; namerec = namerec->next ) {
void initiate_wins_processing(time_t t)
{
static time_t lasttime = 0;
- struct name_record *nr = NULL;
- struct name_record *nrnext = NULL;
if (!lasttime) {
lasttime = t;
tdb_traverse(wins_tdb, wins_processing_traverse_fn, &t);
-
- /* Delete all temporary name records on the wins subnet linked list. */
- for( nr = wins_server_subnet->namelist; nr; nr = nrnext) {
- nrnext = nr->next;
- DLIST_REMOVE(wins_server_subnet->namelist, nr);
- SAFE_FREE(nr->data.ip);
- SAFE_FREE(nr);
- }
+ wins_delete_all_tmp_in_memory_records();
wins_write_database(t, True);
}
size = prs_data_size(&ps);
+ SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data = SMB_MALLOC(size);
if (!state->response.extra_data.data) {
prs_mem_free(&ps);
cell += 1;
/* Append an AFS token string */
+ SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data =
afs_createtoken_str(afsname, cell);
DEBUG(5, ("Setting unix username to [%s]\n", username_out));
+ SAFE_FREE(state->response.extra_data.data);
state->response.extra_data.data = SMB_STRDUP(username_out);
if (!state->response.extra_data.data) {
result = NT_STATUS_NO_MEMORY;
*
* This module Copyright (C) 1990-1998 Karl Auer
*
- * Rewritten almost completely by Christopher R. Hertel
- * at the University of Minnesota, September, 1997.
- * This module Copyright (C) 1997-1998 by the University of Minnesota
+ * Rewritten almost completely by Christopher R. Hertel, 1997.
+ * This module Copyright (C) 1997-1998 by Christopher R. Hertel
+ *
* -------------------------------------------------------------------------- **
*
* This program is free software; you can redistribute it and/or modify
len = init_buffer_from_sam_v3(&buf, src, False);
if (len == -1 || !buf) {
+ SAFE_FREE(buf);
return False;
}
/* save a copy of the key */
ptr->key.dptr = memdup( key.dptr, key.dsize );
+ if (!ptr->key.dptr) {
+ DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n"));
+ /* just return 0 and let the traversal continue */
+ SAFE_FREE(ptr);
+ return 0;
+ }
+
ptr->key.dsize = key.dsize;
DLIST_ADD( tdbsam_pwent_list, ptr );
}
-
return 0;
}
static BOOL tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd, int flag)
{
- uint32 user_rid;
BOOL result = True;
/* invalidate the existing TDB iterator if it is open */
}
#endif
- if ( !(user_rid = pdb_get_user_rid(newpwd)) ) {
+ if (!pdb_get_user_rid(newpwd)) {
DEBUG(0,("tdb_update_sam: struct samu (%s) with no RID!\n", pdb_get_username(newpwd)));
return False;
}
when asked for (and only when supported)
****************************************************************************/
-static struct printif *get_printer_fns_from_type( int type )
+static struct printif *get_printer_fns_from_type( enum printing_types type )
{
struct printif *printer_fns = &generic_printif;
static struct printif *get_printer_fns( int snum )
{
- return get_printer_fns_from_type( lp_printing(snum) );
+ return get_printer_fns_from_type( (enum printing_types)lp_printing(snum) );
}
}
print_queue_update_with_lock(sharename,
- get_printer_fns_from_type(printing_type),
+ get_printer_fns_from_type((enum printing_types)printing_type),
lpqcommand, lprmcommand );
return;
/* get the length */
- len = tdb_pack( buffer, len, "fdPP",
+ len = tdb_pack( NULL, 0, "fdPP",
sharename,
type,
lpqcommand,
pstring evtfilepath;
REGSUBKEY_CTR *subkeys;
REGVAL_CTR *values;
- uint32 uiDisplayNameId;
uint32 uiMaxSize;
uint32 uiRetention;
uint32 uiCategoryCount;
/* hard code some initial values */
- uiDisplayNameId = 0x00000100;
+ /* uiDisplayNameId = 0x00000100; */
uiMaxSize = 0x00080000;
uiRetention = 0x93A80;
PERF_DATA_BLOCK *block,
char *object_ids)
{
- uint32 buffer_size = 0, last_counter;
+ uint32 buffer_size = 0;
const char *fname = counters_directory( NAMES_DB );
TDB_CONTEXT *names;
- int retval;
+ int retval = 0;
names = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);
return 0;
}
- last_counter = reg_perfcount_get_last_counter(base_index);
+ reg_perfcount_get_last_counter(base_index);
if(object_ids == NULL)
{
tdb_close(names);
+ if (retval == -1) {
+ return 0;
+ }
+
return buffer_size + block->HeaderLength;
}
/* get information for a specific printer */
- reg_split_path( printers_key, &printername, &printerdatakey );
+ if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+ return -1;
+ }
/* validate the printer name */
return add_printers_by_registry( subkeys );
}
- reg_split_path( printers_key, &printername, &printerdatakey );
+ if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+ return False;
+ }
/* lookup the printer */
/* lookup the printer object */
- reg_split_path( printers_key, &printername, &printerdatakey );
+ if (!reg_split_path( printers_key, &printername, &printerdatakey )) {
+ return -1;
+ }
+
if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
goto done;
return regdb_store_values( KEY_WINNT_PRINTERS, values );
}
- reg_split_path( printers_key, &printername, &keyname );
+ if (!reg_split_path( printers_key, &printername, &keyname )) {
+ return False;
+ }
if ( !W_ERROR_IS_OK(get_a_printer(NULL, &printer, 2, printername) ) )
return False;
pstrcpy( key2, keystr );
keystr = key2;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
/* sanity check */
/* more of the key path to process */
keystr = subkeypath;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
/* ...\Print\Environements\...\Drivers\ */
if ( strequal(base, "Print Processors") ) {
keystr = subkeypath;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
/* no subkeys below this point */
/* only dealing with drivers from here on out */
keystr = subkeypath;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
+
version = atoi(&base[strlen(base)-1]);
switch (env_index) {
NT_PRINTER_DRIVER_INFO_LEVEL driver_ctr;
WERROR w_result;
- reg_split_path( key, &base, &subkeypath );
+ if (!reg_split_path( key, &base, &subkeypath )) {
+ return -1;
+ }
/* no values in 'Environments\Drivers\Windows NT x86' */
fstrcpy( arch_environment, base );
keystr = subkeypath;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
if ( strequal(base, "Print Processors") )
return 0;
The subkey name has to be Version-XX */
keystr = subkeypath;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
if ( !subkeypath )
return 0;
/* BEGIN PRINTER DRIVER NAME BLOCK */
keystr = subkeypath;
- reg_split_path( keystr, &base, &subkeypath );
+ if (!reg_split_path( keystr, &base, &subkeypath )) {
+ return -1;
+ }
/* don't go any deeper for now */
num_values = handle_printing_subpath( path, NULL, val );
#endif
+ SAFE_FREE(path);
return num_values;
}
/* Now pad with whitespace until the end of the response buffer */
- r_u->end_of_entries_padding =
- SMB_CALLOC_ARRAY(uint8,
- q_u->max_read_size - r_u->num_bytes_in_resp);
+ if (q_u->max_read_size - r_u->num_bytes_in_resp) {
+ r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, q_u->max_read_size - r_u->num_bytes_in_resp);
- if(!(prs_uint8s(False, "end of entries padding", ps,
- depth, r_u->end_of_entries_padding,
- (q_u->max_read_size - r_u->num_bytes_in_resp))))
- {
- return False;
- }
+ if(!(prs_uint8s(False, "end of entries padding", ps,
+ depth, r_u->end_of_entries_padding,
+ (q_u->max_read_size - r_u->num_bytes_in_resp)))) {
+ free(r_u->end_of_entries_padding);
+ return False;
+ }
- free(r_u->end_of_entries_padding);
+ free(r_u->end_of_entries_padding);
+ }
/* We had better be DWORD aligned here */
len = tdb_unpack( ret.dptr, ret.dsize, "ddddd", &reclen,
&tresv1, &trecnum, &timegen, &timewr );
+ if (len == -1) {
+ DEBUG( 10,("make_way_for_eventlogs: tdb_unpack failed.\n"));
+ tdb_unlock_bystring( the_tdb, EVT_NEXT_RECORD );
+ return False;
+ }
+
DEBUG( 8,
( "read record %d, record size is [%d], total so far [%d]\n",
i, reclen, nbytes ) );
int srecno;
int reclen;
int len;
- uint8 *rbuff;
pstring *wpsource, *wpcomputer, *wpsid, *wpstrs, *puserdata;
key.dsize = sizeof( int32 );
- rbuff = NULL;
srecno = recno;
key.dptr = ( char * ) &srecno;
TALLOC_FREE(sampass);
- return NT_STATUS_OK;
+ return nt_status;
}
/*******************************************************************
WERROR werror;
char *servername = NULL, *printername = NULL;
BOOL got_handle = False;
- uint32 needed, offered, num_forms, level = 1, i;
+ uint32 num_forms, level = 1, i;
FORM_1 *forms;
/* Parse the command arguements */
/* Enumerate forms */
- offered = needed = 0;
werror = rpccli_spoolss_enumforms(cli, mem_ctx, &handle, level, &num_forms, &forms);
if (!W_ERROR_IS_OK(werror))
const char **argv)
{
WERROR result;
- uint32 needed, offered, level = 1, num_jobs, i;
+ uint32 level = 1, num_jobs, i;
BOOL got_hnd = False;
pstring printername;
fstring servername, user;
/* Enumerate ports */
- offered = needed = 0;
result = rpccli_spoolss_enumjobs(cli, mem_ctx, &hnd, level, 0, 1000,
&num_jobs, &ctr);
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
+static enum wb_posix_mapping wb_posix_map_type(const char *map_str)
+{
+ if (strequal(map_str, "template"))
+ return WB_POSIX_MAP_TEMPLATE;
+ else if (strequal(map_str, "sfu"))
+ return WB_POSIX_MAP_SFU;
+ else if (strequal(map_str, "rfc2307"))
+ return WB_POSIX_MAP_RFC2307;
+ else if (strequal(map_str, "unixinfo"))
+ return WB_POSIX_MAP_UNIXINFO;
+
+ return WB_POSIX_MAP_UNKNOWN;
+}
+
/* winbind nss info = rfc2307 SO36:sfu FHAIN:rfc2307 PANKOW:template
*
* syntax is:
return WB_POSIX_MAP_TEMPLATE;
}
- if ((map_templ = wb_posix_map_type(list[0])) == -1) {
+ if ((map_templ = wb_posix_map_type(list[0])) == WB_POSIX_MAP_UNKNOWN) {
DEBUG(0,("get_nss_info: invalid setting: %s\n", list[0]));
return WB_POSIX_MAP_TEMPLATE;
}
enum wb_posix_mapping type;
- if ((type = wb_posix_map_type(p)) == -1) {
+ if ((type = wb_posix_map_type(p)) == WB_POSIX_MAP_UNKNOWN) {
DEBUG(0,("get_nss_info: invalid setting: %s\n", p));
/* return WB_POSIX_MAP_TEMPLATE; */
continue;
}
return NULL;
}
-
-enum wb_posix_mapping wb_posix_map_type(const char *map_str)
-{
- if (strequal(map_str, "template"))
- return WB_POSIX_MAP_TEMPLATE;
- else if (strequal(map_str, "sfu"))
- return WB_POSIX_MAP_SFU;
- else if (strequal(map_str, "rfc2307"))
- return WB_POSIX_MAP_RFC2307;
- else if (strequal(map_str, "unixinfo"))
- return WB_POSIX_MAP_UNIXINFO;
-
- return -1;
-}
return False;
}
- if (SearchDir(dptr->dir_hnd, name, poffset)) {
- if (is_visible_file(dptr->conn, dptr->path, name, pst, True)) {
- return True;
- }
- }
- return False;
+ return SearchDir(dptr->dir_hnd, name, poffset);
}
/****************************************************************************
/* If we can't stat it does not show it */
if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) {
+ DEBUG(10,("user_can_read_file: SMB_VFS_STAT failed for file %s with error %s\n",
+ name, strerror(errno) ));
return False;
}
/* If it's a vetoed file, pretend it doesn't even exist */
if (use_veto && IS_VETO_PATH(conn, name)) {
+ DEBUG(10,("is_visible_file: file %s is vetoed.\n", name ));
return False;
}
}
/* Honour _hide unreadable_ option */
if (hide_unreadable && !user_can_read_file(conn, entry, pst)) {
+ DEBUG(10,("is_visible_file: file %s is unreadable.\n", entry ));
SAFE_FREE(entry);
return False;
}
/* Honour _hide unwriteable_ option */
if (hide_unwriteable && !user_can_write_file(conn, entry, pst)) {
+ DEBUG(10,("is_visible_file: file %s is unwritable.\n", entry ));
SAFE_FREE(entry);
return False;
}
/* Honour _hide_special_ option */
if (hide_special && file_is_special(conn, entry, pst)) {
+ DEBUG(10,("is_visible_file: file %s is special.\n", entry ));
SAFE_FREE(entry);
return False;
}
/* should be either no lines or a single line with the mapped username */
- if (numlines) {
+ if (numlines && qlines) {
DEBUG(3,("Mapped user %s to %s\n", user, qlines[0] ));
fstrcpy( user, qlines[0] );
}
* Only add to the file ACL if not inherit only.
*/
- if (!(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
+ if (current_ace && !(psa->flags & SEC_ACE_FLAG_INHERIT_ONLY)) {
DLIST_ADD_END(file_ace, current_ace, tmp_ace);
/*
pstring linein;
BOOL is_eor;
Eventlog_entry ee;
- int pret, rcnum;
+ int rcnum;
f1 = stdin;
if ( !f1 ) {
is_eor = False;
- pret = parse_logentry( ( char * ) &linein, &ee, &is_eor );
+ parse_logentry( ( char * ) &linein, &ee, &is_eor );
/* should we do something with the return code? */
if ( is_eor ) {
{
int opt, rc;
char *exename;
- char *srcname, *eventlogname;
fstring opname;
lp_load( dyn_CONFIGFILE, True, False, False, True);
exename = argv[0];
- srcname = NULL;
/* default */
break;
case 'h':
- usage( argv[0] );
+ usage( exename );
display_eventlog_names( );
exit( 0 );
break;
}
/* note that the separate command types should call usage if they need to... */
- eventlogname = *argv;
while ( 1 ) {
if ( !StrCaseCmp( opname, "addsource" ) ) {
rc = DoAddSourceCommand( argc, argv, opt_debug,
#define SETSTR(name, rec, flag) \
do { if (strequal(ctx->thiscmd, name)) { \
- init_unistr2(&usr->uni_##rec, argv[0], STR_TERMINATE); \
+ init_unistr2(&usr->uni_##rec, argv[0], UNI_STR_TERMINATE); \
init_uni_hdr(&usr->hdr_##rec, &usr->uni_##rec); \
usr->fields_present |= ACCT_##flag; } \
} while (0);
if ((nk = regfio_rootkey( registry )) == NULL) {
d_fprintf(stderr, "Could not get rootkey\n");
+ regfio_close( registry );
return 1;
}
d_printf("[%s]\n", nk->keyname);
static int rpc_registry_copy( int argc, const char **argv )
{
- REGF_FILE *infile, *outfile;
+ REGF_FILE *infile = NULL, *outfile = NULL;
REGF_NK_REC *nk;
int result = 1;
d_printf("Opening %s....", argv[1]);
if ( !(outfile = regfio_open( argv[1], (O_RDWR|O_CREAT|O_TRUNC), (S_IREAD|S_IWRITE) )) ) {
d_fprintf(stderr, "Failed to open %s for writing\n", argv[1]);
- goto out_close_infile;
+ goto out;
}
d_printf("ok\n");
if ((nk = regfio_rootkey( infile )) == NULL) {
d_fprintf(stderr, "Could not get rootkey\n");
- goto out_close_infile;
+ goto out;
}
d_printf("RootKey: [%s]\n", nk->keyname);
result = 0;
+out:
+
d_printf("Closing %s...", argv[1]);
- regfio_close( outfile );
+ if (outfile) {
+ regfio_close( outfile );
+ }
d_printf("ok\n");
-out_close_infile:
d_printf("Closing %s...", argv[0]);
- regfio_close( infile );
+ if (infile) {
+ regfio_close( infile );
+ }
d_printf("ok\n");
return( result);
pstrcpy(acl_str, "usershare_acl=");
for (num_aces = 0; num_aces < psd->dacl->num_aces; num_aces++) {
- char access_str[2];
const char *domain;
const char *name;
NTSTATUS ntstatus;
- access_str[1] = '\0';
-
ntstatus = net_lookup_name_from_sid(ctx, &psd->dacl->ace[num_aces].trustee, &domain, &name);
if (NT_STATUS_IS_OK(ntstatus)) {
const char *my_argv[2];
my_argv[0] = sharename;
my_argv[1] = NULL;
- net_usershare_info(1, argv);
+ net_usershare_info(1, my_argv);
}
SAFE_FREE(sharename);
lang_num++;
}
pl = SMB_MALLOC_ARRAY(struct pri_list, lang_num);
+ if (!pl) {
+ return;
+ }
+
for (i = 0; i < lang_num; i++) {
char *pri_code;
if ((pri_code=strstr(lang_list[i], ";q="))) {