ZERO_STRUCT( fsp );
fsp.file_id = e->id;
- if ( (brl = brl_get_locks(NULL,&fsp)) != NULL ) {
+ if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) {
num_locks = brl->num_locks;
TALLOC_FREE(brl);
}
********************************************************************/
static uint32 get_share_type(int snum)
{
- char *net_name = lp_servicename(snum);
- int len_net_name = strlen(net_name);
-
/* work out the share type */
uint32 type = STYPE_DISKTREE;
type = STYPE_PRINTQ;
if (strequal(lp_fstype(snum), "IPC"))
type = STYPE_IPC;
- if (net_name[len_net_name-1] == '$')
+ if (lp_administrative_share(snum))
type |= STYPE_HIDDEN;
return type;
/*******************************************************************
********************************************************************/
-/* global needed to make use of the share_mode_forall() callback */
-static struct sess_file_count s_file_cnt;
-
static void sess_file_fn( const struct share_mode_entry *e,
- const char *sharepath, const char *fname, void *state )
+ const char *sharepath, const char *fname,
+ void *data )
{
- struct sess_file_count *sess = &s_file_cnt;
+ struct sess_file_count *sess = (struct sess_file_count *)data;
if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) {
sess->count++;
static int net_count_files( uid_t uid, struct server_id pid )
{
+ struct sess_file_count s_file_cnt;
+
s_file_cnt.count = 0;
s_file_cnt.uid = uid;
s_file_cnt.pid = pid;
- share_mode_forall( sess_file_fn, NULL );
+ share_mode_forall( sess_file_fn, &s_file_cnt );
return s_file_cnt.count;
}
WERROR _srv_net_file_enum(pipes_struct *p, SRV_Q_NET_FILE_ENUM *q_u, SRV_R_NET_FILE_ENUM *r_u)
{
+ const char *username = NULL;
+
switch ( q_u->level ) {
- case 3: {
- char *username;
- if (!(username = rpcstr_pull_unistr2_talloc(
- p->mem_ctx, q_u->username))) {
- return WERR_NOMEM;
+ case 3:
+ if (q_u->username) {
+ username = rpcstr_pull_unistr2_talloc(
+ p->mem_ctx, q_u->username);
+ if (!username) {
+ return WERR_NOMEM;
+ }
}
return net_file_enum_3(username, r_u,
get_enum_hnd(&q_u->enum_hnd));
- }
default:
return WERR_UNKNOWN_LEVEL;
}
goto error_exit;
}
- sd_size = sec_desc_size(psd);
+ sd_size = ndr_size_security_descriptor(psd, 0);
r_u->ptr_response = 1;
r_u->size_response = sd_size;