Rename the 'hidden' variable to 'administrative share'.
[ira/wip.git] / source / rpc_server / srv_srvsvc_nt.c
index 3cc2472116a7793b677d223ff557ecc3303fef00..8a25b6cfd5134555ec31d3fe1950e2695c0cdddc 100644 (file)
@@ -167,7 +167,7 @@ static void enum_file_fn( const struct share_mode_entry *e,
        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);
        }
@@ -225,9 +225,6 @@ static WERROR net_enum_files( TALLOC_CTX *ctx, const char *username,
  ********************************************************************/
 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;
 
@@ -235,7 +232,7 @@ static uint32 get_share_type(int snum)
                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;
@@ -870,13 +867,11 @@ static void init_srv_sess_info_0(pipes_struct *p, SRV_SESS_INFO_0 *ss0, uint32 *
 /*******************************************************************
 ********************************************************************/
 
-/* 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++;
@@ -890,11 +885,13 @@ static void sess_file_fn( const struct share_mode_entry *e,
 
 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;
 }
@@ -1219,17 +1216,20 @@ done:
 
 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;
        }
@@ -2159,7 +2159,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
                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;