Add header files for secace and secacl.
[amitay/samba.git] / source4 / libcli / clilist.c
index 341b934aae8376bb238ce8e4bed4b5457e5c4a83..65ee0a8303947227de5e50d34319a37879dbce03 100644 (file)
@@ -6,7 +6,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
 #include "libcli/libcli.h"
 #include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
 
 struct search_private {
        struct clilist_file_info *dirlist;
@@ -38,7 +38,7 @@ struct search_private {
 /****************************************************************************
  Interpret a long filename structure.
 ****************************************************************************/
-static BOOL interpret_long_filename(enum smb_search_data_level level,
+static bool interpret_long_filename(enum smb_search_data_level level,
                                    const union smb_search_data *info,
                                    struct clilist_file_info *finfo)
 {
@@ -66,16 +66,16 @@ static BOOL interpret_long_filename(enum smb_search_data_level level,
 
        default:
                DEBUG(0,("Unhandled level %d in interpret_long_filename\n", (int)level));
-               return False;
+               return false;
        }
 
-       return True;
+       return true;
 }
 
 /* callback function used for trans2 search */
-static BOOL smbcli_list_new_callback(void *private, const union smb_search_data *file)
+static bool smbcli_list_new_callback(void *private_data, const union smb_search_data *file)
 {
-       struct search_private *state = (struct search_private*) private;
+       struct search_private *state = (struct search_private*) private_data;
        struct clilist_file_info *tdl;
  
        /* add file info to the dirlist pool */
@@ -84,7 +84,7 @@ static BOOL smbcli_list_new_callback(void *private, const union smb_search_data
                             struct clilist_file_info,
                             state->dirlist_len + 1);
        if (!tdl) {
-               return False;
+               return false;
        }
        state->dirlist = tdl;
        state->dirlist_len++;
@@ -95,7 +95,7 @@ static BOOL smbcli_list_new_callback(void *private, const union smb_search_data
        state->total_received++;
        state->ff_searchcount++;
        
-       return True;
+       return true;
 }
 
 int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, 
@@ -107,7 +107,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
        union smb_search_next next_parms;
        struct search_private state;  /* for callbacks */
        int received = 0;
-       BOOL first = True;
+       bool first = true;
        int num_received = 0;
        int max_matches = 512;
        char *mask;
@@ -119,7 +119,8 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
        state.dirlist_len = 0;
        state.total_received = 0;
        
-       state.dirlist = talloc_new(state.mem_ctx);
+       state.dirlist = talloc_array(state.mem_ctx, 
+                                    struct clilist_file_info, 0);
        mask = talloc_strdup(state.mem_ctx, Mask);
 
        if (level == RAW_SEARCH_DATA_GENERIC) {
@@ -159,7 +160,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
                        received = first_parms.t2ffirst.out.count;
                        if (received <= 0) break;
                        if (ff_eos) break;
-                       first = False;
+                       first = false;
                } else {
                        NTSTATUS status;
 
@@ -203,7 +204,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
  Interpret a short filename structure.
  The length of the structure is returned.
 ****************************************************************************/
-static BOOL interpret_short_filename(enum smb_search_data_level level,
+static bool interpret_short_filename(enum smb_search_data_level level,
                                     const union smb_search_data *info,
                                     struct clilist_file_info *finfo)
 {
@@ -223,16 +224,16 @@ static BOOL interpret_short_filename(enum smb_search_data_level level,
 
        default:
                DEBUG(0,("Unhandled level %d in interpret_short_filename\n", (int)level));
-               return False;
+               return false;
        }
        
-       return True;
+       return true;
 }
 
 /* callback function used for smb_search */
-static BOOL smbcli_list_old_callback(void *private, const union smb_search_data *file)
+static bool smbcli_list_old_callback(void *private_data, const union smb_search_data *file)
 {
-       struct search_private *state = (struct search_private*) private;
+       struct search_private *state = (struct search_private*) private_data;
        struct clilist_file_info *tdl;
        
        /* add file info to the dirlist pool */
@@ -242,7 +243,7 @@ static BOOL smbcli_list_old_callback(void *private, const union smb_search_data
                             state->dirlist_len + 1);
 
        if (!tdl) {
-               return False;
+               return false;
        }
        state->dirlist = tdl;
        state->dirlist_len++;
@@ -253,7 +254,7 @@ static BOOL smbcli_list_old_callback(void *private, const union smb_search_data
        state->ff_searchcount++;
        state->id = file->search.id; /* return resume info */
        
-       return True;
+       return true;
 }
 
 int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, 
@@ -265,7 +266,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
        struct search_private state;  /* for callbacks */
        const int num_asked = 500;
        int received = 0;
-       BOOL first = True;
+       bool first = true;
        int num_received = 0;
        char *mask;
        int i;
@@ -276,7 +277,8 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
        state.total_received = 0;
        state.data_level = RAW_SEARCH_DATA_SEARCH;
 
-       state.dirlist = talloc_new(state.mem_ctx);
+       state.dirlist = talloc_array(state.mem_ctx, struct clilist_file_info,
+                                    0);
        mask = talloc_strdup(state.mem_ctx, Mask);
   
        while (1) {
@@ -302,7 +304,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
                
                        received = first_parms.search_first.out.count;
                        if (received <= 0) break;
-                       first = False;
+                       first = false;
                } else {
                        NTSTATUS status;