Got "medieval on our ass" about adding the -1 to slprintf.
authorJeremy Allison <jra@samba.org>
Sun, 8 Apr 2001 20:22:39 +0000 (20:22 +0000)
committerJeremy Allison <jra@samba.org>
Sun, 8 Apr 2001 20:22:39 +0000 (20:22 +0000)
Jeremy.

31 files changed:
source/client/client.c
source/client/smbmnt.c
source/client/smbmount.c
source/lib/charset.c
source/lib/messages.c
source/lib/substitute.c
source/lib/util.c
source/lib/util_str.c
source/lib/util_unistr.c
source/libsmb/cli_spoolss.c
source/libsmb/namequery.c
source/msdfs/msdfs.c
source/nmbd/nmbd.c
source/nmbd/nmbd_winsserver.c
source/nsswitch/winbindd.c
source/nsswitch/winbindd_cache.c
source/nsswitch/winbindd_group.c
source/nsswitch/winbindd_idmap.c
source/nsswitch/winbindd_pam.c
source/nsswitch/winbindd_user.c
source/passdb/secrets.c
source/printing/printing.c
source/rpc_parse/parse_prs.c
source/rpc_server/srv_pipe.c
source/rpcclient/cmd_samr.c
source/rpcclient/cmd_spoolss.c
source/smbd/connection.c
source/smbd/dfree.c
source/smbd/process.c
source/smbd/reply.c
source/smbd/server.c

index 04a30ffb212bb71b581d4221aa2d325fd3940f82..65f3a7a75ec858db9dbc36d55883f52f9c2a7c02 100644 (file)
@@ -1838,7 +1838,7 @@ static void process_stdin(void)
                int i;
                
                /* display a prompt */
-               slprintf(prompt, sizeof(prompt), "smb: %s> ", cur_dir);
+               slprintf(prompt, sizeof(prompt)-1, "smb: %s> ", cur_dir);
                line = smb_readline(prompt, readline_callback, completion_fn);
 
                if (!line) break;
index 209d50ab81064b8dfa51b89ed359c347a233ec79..36248987b1ef6b1075c0b78f0bf6ef7d7ac229ac 100644 (file)
@@ -160,7 +160,7 @@ do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data)
                data2 = (char *) data;
        }
 
-       slprintf(opts, sizeof(opts),
+       slprintf(opts, sizeof(opts)-1,
                 "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
                 data->uid, data->gid, data->file_mode, data->dir_mode,options);
        if (mount(share_name, ".", "smbfs", flags, data1) == 0)
index 9b92cf261a0ad07ef7775c4f28f83ec3692bb4e1..35677815fff4a42016695a0dc3612ff9627140b1 100644 (file)
@@ -455,22 +455,22 @@ static void init_mount(void)
                args[i++] = "-r";
        }
        if (mount_uid) {
-               slprintf(tmp, sizeof(tmp), "%d", mount_uid);
+               slprintf(tmp, sizeof(tmp)-1, "%d", mount_uid);
                args[i++] = "-u";
                args[i++] = xstrdup(tmp);
        }
        if (mount_gid) {
-               slprintf(tmp, sizeof(tmp), "%d", mount_gid);
+               slprintf(tmp, sizeof(tmp)-1, "%d", mount_gid);
                args[i++] = "-g";
                args[i++] = xstrdup(tmp);
        }
        if (mount_fmask) {
-               slprintf(tmp, sizeof(tmp), "0%o", mount_fmask);
+               slprintf(tmp, sizeof(tmp)-1, "0%o", mount_fmask);
                args[i++] = "-f";
                args[i++] = xstrdup(tmp);
        }
        if (mount_dmask) {
-               slprintf(tmp, sizeof(tmp), "0%o", mount_dmask);
+               slprintf(tmp, sizeof(tmp)-1, "0%o", mount_dmask);
                args[i++] = "-d";
                args[i++] = xstrdup(tmp);
        }
index fcaca79b8851fe0940dd639738ab555db4382b4c..d699df3e2b89c1d2fda45bba1e620b30b6e6acda 100644 (file)
@@ -205,7 +205,7 @@ static codepage_p load_client_codepage( int client_codepage )
   pstrcat(codepage_file_name, "/");
   pstrcat(codepage_file_name, "codepage.");
   slprintf(&codepage_file_name[strlen(codepage_file_name)], 
-          sizeof(pstring)-(strlen(codepage_file_name)+1),
+          sizeof(pstring)-(strlen(codepage_file_name)+1)-1,
           "%03d",
            client_codepage);
 
index ab02d1253bf77331b97c0566f0af1dd5d4e5e28a..5591f141cc134de528f0bcf80f07f02c69425c7e 100644 (file)
@@ -115,7 +115,7 @@ static TDB_DATA message_key_pid(pid_t pid)
        static char key[20];
        TDB_DATA kbuf;
 
-       slprintf(key, sizeof(key), "PID/%d", (int)pid);
+       slprintf(key, sizeof(key)-1, "PID/%d", (int)pid);
        
        kbuf.dptr = (char *)key;
        kbuf.dsize = strlen(key)+1;
index c4bd1377c281319eeaea8929334090cec8842fc8..6abdeea114c89750337a55e3f2c418b01764b577 100644 (file)
@@ -182,7 +182,7 @@ void standard_sub_basic(char *str)
                case 'T' : string_sub(p,"%T", timestring(False),l); break;
                case 'a' : string_sub(p,"%a", remote_arch,l); break;
                case 'd' :
-                       slprintf(pidstr,sizeof(pidstr), "%d",(int)sys_getpid());
+                       slprintf(pidstr,sizeof(pidstr)-1, "%d",(int)sys_getpid());
                        string_sub(p,"%d", pidstr,l);
                        break;
                case 'h' : string_sub(p,"%h", myhostname(),l); break;
index 2b7cfabf8e556b40a76829fe8fa7e3bee48891a3..439788bdac5e95571e1c83144dded7c67ca3b881 100644 (file)
@@ -1875,7 +1875,7 @@ int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6)
        char pidstr[10];
        pstring cmd = "/usr/X11R6/bin/xterm -display :0 -T Panic -n Panic -e /bin/sh -c 'cat /tmp/ierrs.*.%d ; gdb /proc/%d/exe %d'";
 
-       slprintf(pidstr, sizeof(pidstr), "%d", sys_getpid());
+       slprintf(pidstr, sizeof(pidstr)-1, "%d", sys_getpid());
        pstring_sub(cmd, "%d", pidstr);
 
        if (!fn) {
index e07e5ef6ada681263221cc51d1e0f64b6a6626a0..03ad5a66b0193495df865bc4d0557091986f166a 100644 (file)
@@ -1262,7 +1262,7 @@ char *octal_string(int i)
        if (i == -1) {
                return "-1";
        }
-       slprintf(ret, sizeof(ret), "0%o", i);
+       slprintf(ret, sizeof(ret)-1, "0%o", i);
        return ret;
 }
 
index 3ab4bdca9f1518562bd646b10e384a0248063bb4..18f3b54bf71270e2bdd00e0cfa3227549944bb6e 100644 (file)
@@ -1960,9 +1960,9 @@ smb_ucs2_t *octal_string_w(int i)
        char ret[64];
 
        if (i == -1)
-               slprintf(ret, sizeof(ret), "-1");
+               slprintf(ret, sizeof(ret)-1, "-1");
        else 
-               slprintf(ret, sizeof(ret), "0%o", i);
+               slprintf(ret, sizeof(ret)-1, "0%o", i);
        return unix_to_unicode(wret, ret, sizeof(wret));
 }
 
index b335127b8be89fae19b832883b3d146c41711b17..475ebf66a24d0ad5cca1b0a3e4a416ba6edca3d8 100644 (file)
@@ -474,7 +474,7 @@ uint32 cli_spoolss_enum_ports(struct cli_state *cli, uint32 level,
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
 
-        slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (server);
 
        do {
@@ -701,7 +701,7 @@ uint32 cli_spoolss_enumprinterdrivers (
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
 
-        slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (server);
 
        do 
@@ -781,7 +781,7 @@ uint32 cli_spoolss_getprinterdriverdir (
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
 
-        slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (server);
 
        do 
@@ -848,7 +848,7 @@ uint32 cli_spoolss_addprinterdriver (
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
 
-        slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (server);
 
        /* Initialise input parameters */
@@ -899,9 +899,9 @@ uint32 cli_spoolss_addprinterex (
        ZERO_STRUCT(q);
        ZERO_STRUCT(r);
 
-        slprintf (client, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (client, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (client);
-        slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (server);
        fstrcpy  (user, cli->user_name);
        
index 01ec5e9b29c979ab4d5c5fad3ab6ebf419a91459..781bca7eff13011273fbead4678de64721b2772f 100644 (file)
@@ -1013,7 +1013,7 @@ NT GETDC call, UNICODE, NT domain SID and uncle tom cobbley and all...
        bufp += 2;
        fstrcpy(bufp,srcname);
        bufp += (strlen(bufp) + 1);
-       slprintf(bufp, sizeof(fstring), "\\MAILSLOT\\NET\\GETDC%d", dgm_id);
+       slprintf(bufp, sizeof(fstring)-1, "\\MAILSLOT\\NET\\GETDC%d", dgm_id);
        mailslot_name = bufp;
        bufp += (strlen(bufp) + 1);
        bufp = ALIGN2(bufp, buffer);
index d525edab3cfc874f367ecf63dac5b64719b2275b..b93590fcd24f95f09b7cacf0de71b0517cc22c48 100644 (file)
@@ -690,7 +690,7 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
     jn[cnt].volume_name[0] = '\0';
     jn[cnt].referral_count = 1;
   
-    slprintf(alt_path,"\\\\%s\\%s", global_myname, service_name);
+    slprintf(alt_path,sizeof(alt_path)-1"\\\\%s\\%s", global_myname, service_name);
     jn[cnt].referral_l
     */
 
index 5e8e7e1ec661019c0b15e3083e77b84961d1108f..e176abbe6f1dd75fc9fc35d5edd551aaf2b04da2 100644 (file)
@@ -672,7 +672,7 @@ static void usage(char *pname)
 
   TimeInit();
 
-  slprintf(debugf, sizeof(debugf), "%s/log.nmbd", LOGFILEBASE);
+  slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", LOGFILEBASE);
   setup_logging( argv[0], False );
 
   charset_initialise();
index 33b33040cb296f5a8f83dfa94caaf7ce7f000fbc..454b2170aa7e44fd65d1bb21b0103985e2ca52a1 100644 (file)
@@ -50,7 +50,7 @@ static void wins_hook(char *operation, struct name_record *namerec, int ttl)
        }
        
        p = command;
-       p += slprintf(p, sizeof(command), "%s %s %s %02x %d", 
+       p += slprintf(p, sizeof(command)-1, "%s %s %s %02x %d", 
                      cmd,
                      operation, 
                      namerec->name.name,
@@ -58,7 +58,7 @@ static void wins_hook(char *operation, struct name_record *namerec, int ttl)
                      ttl);
 
        for (i=0;i<namerec->data.num_ips;i++) {
-               p += slprintf(p, sizeof(command) - (p-command), " %s", inet_ntoa(namerec->data.ip[i]));
+               p += slprintf(p, sizeof(command) - (p-command) -1, " %s", inet_ntoa(namerec->data.ip[i]));
        }
 
        DEBUG(3,("calling wins hook for %s\n", nmb_namestr(&namerec->name)));
@@ -1597,9 +1597,9 @@ void wins_write_database(BOOL background)
          }
   }
 
-  slprintf(fname,sizeof(fname),"%s/%s", lp_lockdir(), WINS_LIST);
+  slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
   all_string_sub(fname,"//", "/", 0);
-  slprintf(fnamenew,sizeof(fnamenew),"%s.%u", fname, (unsigned int)sys_getpid());
+  slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
 
   if((fp = sys_fopen(fnamenew,"w")) == NULL)
   {
index 7af1d09723be1364f672e7c412cb35a968fec10b..b0e35f3cd6ef11a68b782f07fc5a04e03a1534a4 100644 (file)
@@ -82,7 +82,7 @@ static void termination_handler(int signum)
 
     /* Remove socket file */
 
-    slprintf(path, sizeof(path), "%s/%s", 
+    slprintf(path, sizeof(path)-1, "%s/%s", 
             WINBINDD_SOCKET_DIR, WINBINDD_SOCKET_NAME);
     unlink(path);
 
@@ -159,7 +159,7 @@ static int create_sock(void)
         return -1;
     }
 
-    slprintf(path, sizeof(path), "%s/%s", 
+    slprintf(path, sizeof(path)-1, "%s/%s", 
             WINBINDD_SOCKET_DIR, WINBINDD_SOCKET_NAME);
 
     unlink(path);
@@ -587,7 +587,7 @@ int main(int argc, char **argv)
     }
 
     /* Initialise samba/rpc client stuff */
-    slprintf(debugf, sizeof(debugf), "%s/log.winbindd", LOGFILEBASE);
+    slprintf(debugf, sizeof(debugf)-1, "%s/log.winbindd", LOGFILEBASE);
     setup_logging("winbindd", interactive);
     reopen_logs();
 
index 226a96b9b50003026db9aca14de9df903be83cb7..7b263dfe009d784ee5edb9ba42ebb11717a543cf 100644 (file)
@@ -55,7 +55,7 @@ static uint32 cached_sequence_number(char *domain_name)
        struct cache_rec rec;
        time_t t = time(NULL);
 
-       slprintf(keystr, sizeof(keystr), "CACHESEQ/%s", domain_name);
+       slprintf(keystr, sizeof(keystr)-1, "CACHESEQ/%s", domain_name);
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
        dbuf = tdb_fetch_by_string(cache_tdb, keystr);
        if (!dbuf.dptr || dbuf.dsize != sizeof(rec)) {
@@ -91,7 +91,7 @@ static BOOL cache_domain_expired(char *domain_name, uint32 seq_num)
 static void set_cache_sequence_number(char *domain_name, char *cache_type, char *subkey)
 {
        fstring keystr;
-       slprintf(keystr,sizeof(keystr),"CACHESEQ %s/%s/%s",
+       slprintf(keystr,sizeof(keystr)-1,"CACHESEQ %s/%s/%s",
                 domain_name, cache_type, subkey?subkey:"");
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
        tdb_store_int(cache_tdb, keystr, cached_sequence_number(domain_name));
@@ -101,7 +101,7 @@ static uint32 get_cache_sequence_number(char *domain_name, char *cache_type, cha
 {
        fstring keystr;
        uint32 seq_num;
-       slprintf(keystr,sizeof(keystr),"CACHESEQ %s/%s/%s",
+       slprintf(keystr,sizeof(keystr)-1,"CACHESEQ %s/%s/%s",
                 domain_name, cache_type, subkey?subkey:"");
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
        seq_num = (uint32)tdb_fetch_int(cache_tdb, keystr);
@@ -125,7 +125,7 @@ static void fill_cache(char *domain_name, char *cache_type,
                  cache_type, domain_name, num_sam_entries));
 
        /* Store data as a mega-huge chunk in the tdb */
-       slprintf(keystr, sizeof(keystr), "%s CACHE DATA/%s", cache_type,
+       slprintf(keystr, sizeof(keystr)-1, "%s CACHE DATA/%s", cache_type,
                 domain_name);
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
        tdb_store_by_string(cache_tdb, keystr, 
@@ -158,7 +158,7 @@ static void fill_cache_entry(char *domain, char *cache_type, char *name, void *b
        fstring keystr;
 
        /* Create key for store */
-       slprintf(keystr, sizeof(keystr), "%s/%s/%s", cache_type, domain, name);
+       slprintf(keystr, sizeof(keystr)-1, "%s/%s/%s", cache_type, domain, name);
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
 
        DEBUG(4, ("filling cache entry %s\n", keystr));
@@ -185,7 +185,7 @@ void winbindd_fill_uid_cache_entry(char *domain, uid_t uid,
 
         if (lp_winbind_cache_time() == 0) return;
 
-        slprintf(uidstr, sizeof(uidstr), "#%u", (unsigned)uid);
+        slprintf(uidstr, sizeof(uidstr)-1, "#%u", (unsigned)uid);
         fill_cache_entry(domain, CACHE_TYPE_USER, uidstr, pw, sizeof(struct winbindd_pw));
         set_cache_sequence_number(domain, CACHE_TYPE_USER, uidstr);
 }
@@ -203,7 +203,7 @@ void winbindd_fill_group_cache_entry(char *domain, char *group_name,
         fill_cache_entry(domain, CACHE_TYPE_GROUP, group_name, gr, sizeof(struct winbindd_gr));
 
         /* Fill extra data */
-        slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain, group_name);
+        slprintf(keystr, sizeof(keystr)-1, "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain, group_name);
         dos_to_unix(keystr, True);         /* Convert key to unix-codepage */
         tdb_store_by_string(cache_tdb, keystr, extra_data, extra_data_len);
 
@@ -218,7 +218,7 @@ void winbindd_fill_gid_cache_entry(char *domain, gid_t gid,
         fstring keystr;
        fstring gidstr;
 
-       slprintf(gidstr, sizeof(gidstr), "#%u", (unsigned)gid);
+       slprintf(gidstr, sizeof(gidstr)-1, "#%u", (unsigned)gid);
 
         if (lp_winbind_cache_time() == 0) return;
 
@@ -226,7 +226,7 @@ void winbindd_fill_gid_cache_entry(char *domain, gid_t gid,
         fill_cache_entry(domain, CACHE_TYPE_GROUP, gidstr, gr, sizeof(struct winbindd_gr));
 
         /* Fill extra data */
-        slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain, gidstr);
+        slprintf(keystr, sizeof(keystr)-1, "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain, gidstr);
         dos_to_unix(keystr, True);         /* Convert key to unix-codepage */
         tdb_store_by_string(cache_tdb, keystr, extra_data, extra_data_len);
 
@@ -254,7 +254,7 @@ static BOOL fetch_cache(char *domain_name, char *cache_type,
        }
        
         /* Create key */        
-        slprintf(keystr, sizeof(keystr), "%s CACHE DATA/%s", cache_type,
+        slprintf(keystr, sizeof(keystr)-1, "%s CACHE DATA/%s", cache_type,
                  domain_name);
         dos_to_unix(keystr, True);         /* Convert key to unix-codepage */
        
@@ -304,7 +304,7 @@ static BOOL fetch_cache_entry(char *domain, char *cache_type, char *name, void *
        fstring keystr;
     
        /* Create key for lookup */
-       slprintf(keystr, sizeof(keystr), "%s/%s/%s", cache_type, domain, name);
+       slprintf(keystr, sizeof(keystr)-1, "%s/%s/%s", cache_type, domain, name);
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
     
        /* Look up cache entry */
@@ -342,7 +342,7 @@ BOOL winbindd_fetch_uid_cache_entry(char *domain_name, uid_t uid,
 
         if (lp_winbind_cache_time() == 0) return False;
 
-       slprintf(uidstr, sizeof(uidstr), "#%u", (unsigned)uid);
+       slprintf(uidstr, sizeof(uidstr)-1, "#%u", (unsigned)uid);
        seq_num = get_cache_sequence_number(domain_name, CACHE_TYPE_USER, uidstr);
        if (cache_domain_expired(domain_name, seq_num)) return False;
 
@@ -369,7 +369,7 @@ BOOL winbindd_fetch_group_cache_entry(char *domain_name, char *group,
         if (!fetch_cache_entry(domain_name, CACHE_TYPE_GROUP, group, gr, sizeof(struct winbindd_gr))) return False;
        
         /* Fetch extra data */
-        slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain_name, group);
+        slprintf(keystr, sizeof(keystr)-1, "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain_name, group);
         dos_to_unix(keystr, True);         /* Convert key to unix-codepage */
         data = tdb_fetch_by_string(cache_tdb, keystr);
 
@@ -395,7 +395,7 @@ BOOL winbindd_fetch_gid_cache_entry(char *domain_name, gid_t gid,
        fstring gidstr;
        uint32 seq_num;
 
-       slprintf(gidstr, sizeof(gidstr), "#%u", (unsigned)gid);
+       slprintf(gidstr, sizeof(gidstr)-1, "#%u", (unsigned)gid);
        
         if (lp_winbind_cache_time() == 0) return False;
 
@@ -407,7 +407,7 @@ BOOL winbindd_fetch_gid_cache_entry(char *domain_name, gid_t gid,
                               gidstr, gr, sizeof(struct winbindd_gr))) return False;
 
         /* Fetch extra data */
-        slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain_name, gidstr);
+        slprintf(keystr, sizeof(keystr)-1, "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain_name, gidstr);
         dos_to_unix(keystr, True);         /* Convert key to unix-codepage */
         data = tdb_fetch_by_string(cache_tdb, keystr);
         if (!data.dptr) return False;
index e96947b7e6517130ad02964044314c0138050633..77825cd579839d2337949443318659abfdd1e7cc 100644 (file)
@@ -270,7 +270,7 @@ static BOOL winbindd_fill_grent_mem(struct winbindd_domain *domain,
                          malloc(sizeof(*entry))) != NULL) {
 
                         /* Create name */
-                       slprintf(entry->name, sizeof(entry->name),
+                       slprintf(entry->name, sizeof(entry->name)-1,
                                 "%s%s%s", name_dom, lp_winbind_separator(), name_user);
                         
                         /* Add to list */
@@ -477,7 +477,7 @@ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state *sta
             return WINBINDD_OK;
     }
 
-    slprintf(name, sizeof(name), "%s\\%s", name_domain, name_group);
+    slprintf(name, sizeof(name)-1, "%s\\%s", name_domain, name_group);
 
     /* Get rid and name type from name */
         
@@ -717,7 +717,7 @@ enum winbindd_result winbindd_getgrent(struct winbindd_cli_state *state)
    
             /* Prepend domain to name */
 
-           slprintf(domain_group_name, sizeof(domain_group_name),
+           slprintf(domain_group_name, sizeof(domain_group_name)-1,
                     "%s%s%s", ent->domain->name, lp_winbind_separator(), group_name);
    
             /* Get group entry from group name */
index ff0818c4565b17058e95446f3f8dcfe681d60e55..11f7b8aae7a76e3f9431433bcb54258e77d00be6 100644 (file)
@@ -77,7 +77,7 @@ static BOOL get_id_from_rid(char *domain_name, uint32 rid, int *id,
 
     /* Check if rid is present in database */
 
-    slprintf(keystr, sizeof(keystr), "%s/%d", domain_name, rid);
+    slprintf(keystr, sizeof(keystr)-1, "%s/%d", domain_name, rid);
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
     
     key.dptr = keystr;
@@ -116,7 +116,7 @@ static BOOL get_id_from_rid(char *domain_name, uint32 rid, int *id,
 
             /* Store new id */
             
-            slprintf(keystr2, sizeof(keystr2), "%s %d", isgroup ? "GID" :
+            slprintf(keystr2, sizeof(keystr2)-1, "%s %d", isgroup ? "GID" :
                      "UID", *id);
 
             data.dptr = keystr2;
@@ -155,7 +155,7 @@ BOOL get_rid_from_id(int id, uint32 *rid, struct winbindd_domain **domain,
     fstring keystr;
     BOOL result = False;
 
-    slprintf(keystr, sizeof(keystr), "%s %d", isgroup ? "GID" : "UID", id);
+    slprintf(keystr, sizeof(keystr)-1, "%s %d", isgroup ? "GID" : "UID", id);
 
     key.dptr = keystr;
     key.dsize = strlen(keystr) + 1;
index 48a1a829ebc79d81431b5ed95e7420225da1d904..c74afd8e291c319e595e70103c25216eecdf82fa 100644 (file)
@@ -55,7 +55,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
 
        nt_lm_owf_gen(state->request.data.auth.pass, ntpw, lmpw);
 
-       slprintf(server, sizeof(server), "\\\\%s", server_state.controller);
+       slprintf(server, sizeof(server)-1, "\\\\%s", server_state.controller);
 
        status = domain_client_validate_backend(server, 
                                                name_user, name_domain,
index 9a73b0107b0a48a74c0c0f8b0cac36b135653cdd..f3e62d2f7f101298162edc397e4749e2d466c242 100644 (file)
@@ -106,7 +106,7 @@ enum winbindd_result winbindd_getpwnam_from_user(struct winbindd_cli_state *stat
             return WINBINDD_OK;
     }
 
-    slprintf(name,sizeof(name),"%s\\%s", name_domain, name_user);
+    slprintf(name,sizeof(name)-1,"%s\\%s", name_domain, name_user);
 
     /* Get rid and name type from name */
     /* the following costs 1 packet */
@@ -364,7 +364,7 @@ enum winbindd_result winbindd_getpwent(struct winbindd_cli_state *state)
 
             /* Prepend domain to name */
 
-           slprintf(domain_user_name, sizeof(domain_user_name),
+           slprintf(domain_user_name, sizeof(domain_user_name)-1,
                     "%s%s%s", ent->domain->name, lp_winbind_separator(), user_name);
                 
             /* Get passwd entry from user name */
index bfa1ed98cadc4cf1da043f6d24cf1fde58a13835..a3b49cd5916e0a76feabde07b6cef246b3c863e9 100644 (file)
@@ -88,7 +88,7 @@ BOOL secrets_store_domain_sid(char *domain, DOM_SID *sid)
 {
        fstring key;
 
-       slprintf(key, sizeof(key), "%s/%s", SECRETS_DOMAIN_SID, domain);
+       slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain);
        return secrets_store(key, sid, sizeof(DOM_SID));
 }
 
@@ -98,7 +98,7 @@ BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid)
        fstring key;
        size_t size;
 
-       slprintf(key, sizeof(key), "%s/%s", SECRETS_DOMAIN_SID, domain);
+       slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain);
        dos_to_unix(key, True);                /* Convert key to unix-codepage */
        dyn_sid = (DOM_SID *)secrets_fetch(key, &size);
 
@@ -128,7 +128,7 @@ char *trust_keystr(char *domain)
        fstrcpy(dos_domain, domain);
        unix_to_dos(dos_domain, True);
 
-       slprintf(keystr,sizeof(keystr),"%s/%s", 
+       slprintf(keystr,sizeof(keystr)-1,"%s/%s", 
                 SECRETS_MACHINE_ACCT_PASS, dos_domain);
 
        return keystr;
index e886bd75a2ce65f52fbbb685c27159b585d3546a..753d0f7f966c46fed3d7997f99baf37a65a832fa 100644 (file)
@@ -254,7 +254,7 @@ check if the print queue has been updated recently enough
 static void print_cache_flush(int snum)
 {
        fstring key;
-       slprintf(key, sizeof(key), "CACHE/%s", lp_servicename(snum));
+       slprintf(key, sizeof(key)-1, "CACHE/%s", lp_servicename(snum));
        dos_to_unix(key, True);                /* Convert key to unix-codepage */
        tdb_store_int(tdb, key, -1);
 }
@@ -269,7 +269,7 @@ static pid_t get_updating_pid(fstring printer_name)
        TDB_DATA data, key;
        pid_t updating_pid;
 
-       slprintf(keystr, sizeof(keystr), "UPDATING/%s", printer_name);
+       slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", printer_name);
        key.dptr = keystr;
        key.dsize = strlen(keystr);
 
@@ -298,7 +298,7 @@ static void set_updating_pid(fstring printer_name, BOOL delete)
        TDB_DATA data;
        pid_t updating_pid = getpid();
 
-       slprintf(keystr, sizeof(keystr), "UPDATING/%s", printer_name);
+       slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", printer_name);
        key.dptr = keystr;
        key.dsize = strlen(keystr);
 
@@ -380,7 +380,7 @@ static void print_queue_update(int snum)
         * if the lpq takes a long time.
         */
 
-       slprintf(cachestr, sizeof(cachestr), "CACHE/%s", printer_name);
+       slprintf(cachestr, sizeof(cachestr)-1, "CACHE/%s", printer_name);
        tdb_store_int(tdb, cachestr, (int)time(NULL));
 
         /* get the current queue using the appropriate interface */
@@ -452,7 +452,7 @@ static void print_queue_update(int snum)
        }
 
        /* store the new queue status structure */
-       slprintf(keystr, sizeof(keystr), "STATUS/%s", printer_name);
+       slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", printer_name);
        key.dptr = keystr;
        key.dsize = strlen(keystr);
 
@@ -466,7 +466,7 @@ static void print_queue_update(int snum)
         * as little as possible...
         */
 
-       slprintf(keystr, sizeof(keystr), "CACHE/%s", printer_name);
+       slprintf(keystr, sizeof(keystr)-1, "CACHE/%s", printer_name);
        tdb_store_int(tdb, keystr, (int)time(NULL));
 
        /* Delete our pid from the db. */
@@ -751,7 +751,7 @@ static BOOL print_cache_expired(int snum)
        fstring key;
        time_t t2, t = time(NULL);
 
-       slprintf(key, sizeof(key), "CACHE/%s", lp_servicename(snum));
+       slprintf(key, sizeof(key)-1, "CACHE/%s", lp_servicename(snum));
        dos_to_unix(key, True);                /* Convert key to unix-codepage */
        t2 = tdb_fetch_int(tdb, key);
        if (t2 == ((time_t)-1) || (t - t2) >= lp_lpqcachetime()) {
@@ -770,7 +770,7 @@ static int get_queue_status(int snum, print_status_struct *status)
        TDB_DATA data, key;
 
        ZERO_STRUCTP(status);
-       slprintf(keystr, sizeof(keystr), "STATUS/%s", lp_servicename(snum));
+       slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", lp_servicename(snum));
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
        key.dptr = keystr;
        key.dsize = strlen(keystr);
@@ -912,7 +912,7 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
           a symlink security hole - it allows us to use O_EXCL 
           There may be old spool files owned by other users lying around.
        */
-       slprintf(pjob.filename, sizeof(pjob.filename), "%s/%s%d", 
+       slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%s%d", 
                 path, PRINT_SPOOL_PREFIX, jobid);
        if (unlink(pjob.filename) == -1 && errno != ENOENT) {
                goto next_jobnum;
@@ -1120,7 +1120,7 @@ int print_queue_status(int snum,
         * be no jobs in the queue.
         */
        ZERO_STRUCTP(status);
-       slprintf(keystr, sizeof(keystr), "STATUS/%s", lp_servicename(snum));
+       slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", lp_servicename(snum));
        dos_to_unix(keystr, True);             /* Convert key to unix-codepage */
        key.dptr = keystr;
        key.dsize = strlen(keystr);
index 8311528874fff59b18af83c48818a62ee0e15be6..6bab18ba9d77b111d8ef73bae391d4b21940f504 100644 (file)
@@ -36,9 +36,9 @@ void prs_dump(char *name, int v, prs_struct *ps)
        if (DEBUGLEVEL < 50) return;
        for (i=1;i<100;i++) {
                if (v != -1) {
-                       slprintf(fname,sizeof(fname), "/tmp/%s_%d.%d.prs", name, v, i);
+                       slprintf(fname,sizeof(fname)-1, "/tmp/%s_%d.%d.prs", name, v, i);
                } else {
-                       slprintf(fname,sizeof(fname), "/tmp/%s.%d.prs", name, i);
+                       slprintf(fname,sizeof(fname)-1, "/tmp/%s.%d.prs", name, i);
                }
                fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
                if (fd != -1 || errno != EEXIST) break;
index 32ec81b07adbd429c466ca9adda7d5c9dbadb43b..0654f24493a8c491e5774284711a4023984087c1 100644 (file)
@@ -1171,7 +1171,7 @@ BOOL api_rpcTNP(pipes_struct *p, char *rpc_name,
        /* interpret the command */
        DEBUG(4,("api_rpcTNP: %s op 0x%x - ", rpc_name, p->hdr_req.opnum));
 
-       slprintf(name, sizeof(name), "in_%s", rpc_name);
+       slprintf(name, sizeof(name)-1, "in_%s", rpc_name);
        prs_dump(name, p->hdr_req.opnum, &p->in_data.data);
 
        for (fn_num = 0; api_rpc_cmds[fn_num].name; fn_num++) {
@@ -1201,7 +1201,7 @@ BOOL api_rpcTNP(pipes_struct *p, char *rpc_name,
                return False;
        }
 
-       slprintf(name, sizeof(name), "out_%s", rpc_name);
+       slprintf(name, sizeof(name)-1, "out_%s", rpc_name);
        offset2 = prs_offset(&p->out_data.rdata);
        prs_set_offset(&p->out_data.rdata, offset1);
        prs_dump(name, p->hdr_req.opnum, &p->out_data.rdata);
index ca9469aede0636c971dcab8a0f126f76faeb7e23..b3d135275a77426b24cd7722d0ff74a62a957309 100644 (file)
@@ -120,7 +120,7 @@ static uint32 cmd_samr_query_user(struct cli_state *cli, int argc, char **argv)
                return NT_STATUS_UNSUCCESSFUL;
        }
        
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
        
        if ((result = cli_samr_connect(cli, server, MAXIMUM_ALLOWED_ACCESS,
@@ -239,7 +239,7 @@ static uint32 cmd_samr_query_group(struct cli_state *cli, int argc, char **argv)
                return NT_STATUS_UNSUCCESSFUL;
        }
        
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
 
        if ((result = cli_samr_connect(cli, server, MAXIMUM_ALLOWED_ACCESS,
@@ -319,7 +319,7 @@ static uint32 cmd_samr_query_usergroups(struct cli_state *cli, int argc, char **
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
                
        if ((result = cli_samr_connect(cli, server, MAXIMUM_ALLOWED_ACCESS,
@@ -396,7 +396,7 @@ static uint32 cmd_samr_query_groupmem(struct cli_state *cli, int argc, char **ar
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
 
        if ((result = cli_samr_connect(cli, server, MAXIMUM_ALLOWED_ACCESS,
index 0b45767afe173842ce1cb3d7426b416f4baa39a4..157abb27f51e25ca11a558737177854ab08df965 100644 (file)
@@ -158,7 +158,7 @@ static uint32 cmd_spoolss_open_printer_ex(struct cli_state *cli, int argc, char
                return NT_STATUS_UNSUCCESSFUL;
                
 
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
        fstrcpy  (user, cli->user_name);
        fstrcpy  (printername, argv[1]);
@@ -503,9 +503,9 @@ static uint32 cmd_spoolss_getprinter(struct cli_state *cli, int argc, char **arg
                info_level = atoi(argv[2]);
        }
 
-       slprintf (servername, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (servername, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (servername);
-       slprintf (printername, sizeof(fstring), "\\\\%s\\%s", servername, argv[1]);
+       slprintf (printername, sizeof(fstring)-1, "\\\\%s\\%s", servername, argv[1]);
        fstrcpy  (username, cli->user_name);
        
        /* get a printer handle */
@@ -691,7 +691,7 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
        }
 
        /* get the arguments need to open the printer handle */
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
        fstrcpy  (user, cli->user_name);
        fstrcpy  (printername, argv[1]);
@@ -789,7 +789,7 @@ static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **a
        }
 
        /* get the arguments need to open the printer handle */
-       slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+       slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
        strupper (server);
        if (argc == 2)
                info_level = atoi(argv[1]);
@@ -1091,7 +1091,7 @@ static uint32 cmd_spoolss_addprinterex (struct cli_state *cli, int argc, char **
                return NT_STATUS_NOPROBLEMO;
         }
 
-        slprintf (server, sizeof(fstring), "\\\\%s", cli->desthost);
+        slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
         strupper (server);
 
        /* Initialise RPC connection */
index 8ab4e0c5d3f24cbd2e865ecc0fd4bdb88bf812d9..125b2fbbe54707b8118e24bd573b906dbbcf9628 100644 (file)
@@ -434,7 +434,7 @@ static int utmp_fill(struct utmp *u, const connection_struct *conn, pid_t pid,
  * o  with overflow if ut_line would be more than full.
  */
        memset(line_tmp, '\0', sizeof(line_tmp));
-       slprintf(line_tmp, sizeof(line_tmp), (char *) ut_line_template, i);
+       slprintf(line_tmp, sizeof(line_tmp)-1, (char *) ut_line_template, i);
        line_len = strlen(line_tmp);
        if (line_len <= sizeof(u->ut_line)) {
                memcpy(u->ut_line, line_tmp, sizeof(u->ut_line));
index c523f2cab4b6b703592c0c89bfccba93f4a5be99..64c6182cd8d4a58b1e15fcc6b4460e5da12bf68e 100644 (file)
@@ -88,7 +88,7 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query,
                char **lines;
                pstring syscmd;
 
-               slprintf(syscmd, sizeof(syscmd), "%s %s", dfree_command, path);
+               slprintf(syscmd, sizeof(syscmd)-1, "%s %s", dfree_command, path);
                DEBUG (3, ("disk_free: Running command %s\n", syscmd));
 
                lines = file_lines_pload(syscmd, NULL, True);
index dea7130cfedfcf05c761565dcbe38374fdae7dc8..ac5454c48c8d1d23ebc31afb0139493369c706f7 100644 (file)
@@ -592,7 +592,7 @@ static void smb_dump(char *name, int type, char *data, ssize_t len)
 
        if (len < 4) len = smb_len(data)+4;
        for (i=1;i<100;i++) {
-               slprintf(fname,sizeof(fname), "/tmp/%s.%d.%s", name, i,
+               slprintf(fname,sizeof(fname)-1, "/tmp/%s.%d.%s", name, i,
                                type ? "req" : "resp");
                fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
                if (fd != -1 || errno != EEXIST) break;
index 35a4b0f54abfae100165f57b8ba9287b2adb07bc..4176dd01040e9198509de6b90ee80768fb9b936d 100644 (file)
@@ -880,7 +880,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
   if (!sys_getpwnam(user)) {
          pstring user2;
 
-         slprintf(user2,sizeof(user2),"%s%s%s", dos_to_unix(domain,False), 
+         slprintf(user2,sizeof(user2)-1,"%s%s%s", dos_to_unix(domain,False), 
                   lp_winbind_separator(), user);
 
          if (sys_getpwnam(user2)) {
index baa1536248a3faea773cf062fc4f090e99de3c75..adf57b3f5521d78626535f34c1f51f7e32327c47 100644 (file)
@@ -626,7 +626,7 @@ static void usage(char *pname)
        TimeInit();
 
        if(!specified_logfile) {
-               slprintf(debugf, sizeof(debugf), "%s/log.smbd", LOGFILEBASE);
+               slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd", LOGFILEBASE);
        }
 
        pstrcpy(remote_machine, "smbd");