get rid of compiler warnings
[ira/wip.git] / source3 / utils / smbcacls.c
index 7b459a32ed6b32fda56508c4a49c6f2c12433ea8..9e8cbb1ddd11b35fe63e3a57edf53cd69670f818 100644 (file)
@@ -234,7 +234,7 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
        struct perm_value *v;
 
        ZERO_STRUCTP(ace);
-       p = strchr(str,':');
+       p = strchr_m(str,':');
        if (!p) return False;
        *p = '\0';
        p++;
@@ -266,12 +266,12 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
 
        /* Only numeric form accepted for flags at present */
 
-       if (!(next_token(NULL, tok, "/", sizeof(fstring)) &&
+       if (!(next_token(&p, tok, "/", sizeof(fstring)) &&
              sscanf(tok, "%i", &aflags))) {
                return False;
        }
 
-       if (!next_token(NULL, tok, "/", sizeof(fstring))) {
+       if (!next_token(&p, tok, "/", sizeof(fstring))) {
                return False;
        }
 
@@ -340,7 +340,7 @@ static SEC_DESC *sec_desc_parse(char *str)
        char *p = str;
        fstring tok;
        SEC_DESC *ret;
-       unsigned sd_size;
+       size_t sd_size;
        DOM_SID *grp_sid=NULL, *owner_sid=NULL;
        SEC_ACL *dacl=NULL;
        int revision=1;
@@ -692,19 +692,16 @@ struct cli_state *connect_one(char *share)
 {
        struct cli_state *c;
        struct nmb_name called, calling;
-       char *server_n;
        struct in_addr ip;
        extern struct in_addr ipzero;
        extern pstring global_myname;
 
        fstrcpy(server,share+2);
-       share = strchr(server,'\\');
+       share = strchr_m(server,'\\');
        if (!share) return NULL;
        *share = 0;
        share++;
 
-       server_n = server;
-       
        ip = ipzero;
 
        make_nmb_name(&calling, global_myname, 0x0);
@@ -714,9 +711,8 @@ struct cli_state *connect_one(char *share)
        ip = ipzero;
 
        /* have to open a new connection */
-       if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
-           !cli_connect(c, server_n, &ip)) {
-               DEBUG(0,("Connection to %s failed\n", server_n));
+       if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, &ip)) {
+               DEBUG(0,("Connection to %s failed\n", server));
                cli_shutdown(c);
                safe_free(c);
                return NULL;
@@ -788,6 +784,8 @@ static void usage(void)
 \t-G username             change group ownership of a file\n\
 \t-n                      don't resolve sids or masks to names\n\
 \t-h                      print help\n\
+\t-d debuglevel           set debug output level\n\
+\t-U username             user to autheticate as\n\
 \n\
 The username can be of the form username%%password or\n\
 workgroup\\username%%password.\n\n\
@@ -810,7 +808,7 @@ You can string acls together with spaces, commas or newlines\n\
        char *p;
        static pstring servicesf = CONFIGFILE;
        struct cli_state *cli=NULL;
-       enum acl_mode mode = 0;
+       enum acl_mode mode = SMB_ACL_SET;
        char *the_acl = NULL;
        enum chown_mode change_mode = REQUEST_NONE;
        int result;
@@ -837,29 +835,27 @@ You can string acls together with spaces, commas or newlines\n\
        argv += 2;
 
        TimeInit();
-       charset_initialise();
 
        lp_load(servicesf,True,False,False);
-       codepage_initialise(lp_client_code_page());
        load_interfaces();
 
        if (getenv("USER")) {
                pstrcpy(username,getenv("USER"));
 
-               if ((p=strchr(username,'%'))) {
+               if ((p=strchr_m(username,'%'))) {
                        *p = 0;
                        pstrcpy(password,p+1);
                        got_pass = True;
-                       memset(strchr(getenv("USER"), '%') + 1, 'X',
+                       memset(strchr_m(getenv("USER"), '%') + 1, 'X',
                               strlen(password));
                }
        }
 
-       while ((opt = getopt(argc, argv, "U:nhS:D:A:M:C:G:t")) != EOF) {
+       while ((opt = getopt(argc, argv, "U:nhS:D:A:M:C:G:td:")) != EOF) {
                switch (opt) {
                case 'U':
                        pstrcpy(username,optarg);
-                       p = strchr(username,'%');
+                       p = strchr_m(username,'%');
                        if (p) {
                                *p = 0;
                                pstrcpy(password, p+1);
@@ -910,6 +906,10 @@ You can string acls together with spaces, commas or newlines\n\
                        talloc_destroy(ctx);
                        exit(EXIT_PARSE_ERROR);
 
+               case 'd':
+                       DEBUGLEVEL = atoi(optarg);
+                       break;
+
                default:
                        printf("Unknown option %c (%d)\n", (char)opt, opt);
                        talloc_destroy(ctx);