diff options
author | Simo Sorce <idra@samba.org> | 2002-01-19 17:29:32 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2002-01-19 17:29:32 +0000 |
commit | 6b123adda901ff05b0271eeda060297448f64eec (patch) | |
tree | be347f8ec34eeea959cd8f92806251974c414a0a /source | |
parent | af37a86917c969118a46cff7574487dbe1c75a2f (diff) | |
download | samba-6b123adda901ff05b0271eeda060297448f64eec.tar.gz samba-6b123adda901ff05b0271eeda060297448f64eec.tar.xz samba-6b123adda901ff05b0271eeda060297448f64eec.zip |
fixes (asprintf) from 2.2
Diffstat (limited to 'source')
-rw-r--r-- | source/client/client.c | 8 | ||||
-rw-r--r-- | source/lib/snprintf.c | 1 | ||||
-rw-r--r-- | source/nsswitch/winbindd_cm.c | 10 | ||||
-rw-r--r-- | source/passdb/pdb_tdb.c | 12 | ||||
-rw-r--r-- | source/rpcclient/cmd_spoolss.c | 10 |
5 files changed, 24 insertions, 17 deletions
diff --git a/source/client/client.c b/source/client/client.c index f1059f8ee1f..eb9750299b7 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -1343,7 +1343,7 @@ static int cmd_mput(void) /* if (!recurse) continue; */ SAFE_FREE(quest); - asprintf(&quest, "Put directory %s? ", lname); + if (asprintf(&quest, "Put directory %s? ", lname) < 0) break; if (prompt && !yesno(quest)) { /* No */ /* Skip the directory */ lname[strlen(lname)-1] = '/'; @@ -1351,7 +1351,7 @@ static int cmd_mput(void) break; } else { /* Yes */ SAFE_FREE(rname); - asprintf(&rname, "%s%s", cur_dir, lname); + if(asprintf(&rname, "%s%s", cur_dir, lname) < 0) break; dos_format(rname); if (!cli_chkpath(cli, rname) && !do_mkdir(rname)) { @@ -1365,13 +1365,13 @@ static int cmd_mput(void) continue; } else { SAFE_FREE(quest); - asprintf(&quest,"Put file %s? ", lname); + if (asprintf(&quest,"Put file %s? ", lname) < 0) break; if (prompt && !yesno(quest)) /* No */ continue; /* Yes */ SAFE_FREE(rname); - asprintf(&rname, "%s%s", cur_dir, lname); + if (asprintf(&rname, "%s%s", cur_dir, lname) < 0) break; } dos_format(rname); diff --git a/source/lib/snprintf.c b/source/lib/snprintf.c index 88eea2824be..9a9dcdbae1e 100644 --- a/source/lib/snprintf.c +++ b/source/lib/snprintf.c @@ -803,6 +803,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) va_list ap; int ret; + *ptr = NULL; va_start(ap, format); ret = vasprintf(ptr, format, ap); va_end(ap); diff --git a/source/nsswitch/winbindd_cm.c b/source/nsswitch/winbindd_cm.c index 013289ed136..5d6c758e107 100644 --- a/source/nsswitch/winbindd_cm.c +++ b/source/nsswitch/winbindd_cm.c @@ -712,10 +712,12 @@ static void dump_conn_list(void) /* Display pipe info */ - asprintf(&msg, "\t%-15s %-15s %-16s", con->domain, con->controller, con->pipe_name); - - DEBUG(0, ("%s\n", msg)); - free(msg); + if (asprintf(&msg, "\t%-15s %-15s %-16s", con->domain, con->controller, con->pipe_name) < 0) { + DEBUG(0, ("Error: not enough memory!\n")); + } else { + DEBUG(0, ("%s\n", msg)); + SAFE_FREE(msg); + } } } diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c index 1f234edc933..b33e684c7a1 100644 --- a/source/passdb/pdb_tdb.c +++ b/source/passdb/pdb_tdb.c @@ -488,13 +488,13 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user) sam_user = pdb_get_username(user); pstrcpy(sam_subst, pdb_get_logon_script(user)); standard_sub_advanced(-1, sam_user, "", gid, sam_user, sam_subst); - pdb_set_logon_script(user, sam_subst, True); + if (!pdb_set_logon_script(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_profile_path(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_profile_path(user, sam_subst, True); + if (!pdb_set_profile_path(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_homedir(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_homedir(user, sam_subst, True); + if (!pdb_set_homedir(user, sam_subst, True)) return False; /* increment to next in line */ global_tdb_ent.key = tdb_nextkey(global_tdb_ent.passwd_tdb, global_tdb_ent.key); @@ -578,13 +578,13 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, const char *sname) sam_user = pdb_get_username(user); pstrcpy(sam_subst, pdb_get_logon_script(user)); standard_sub_advanced(-1, sam_user, "", gid, sam_user, sam_subst); - pdb_set_logon_script(user, sam_subst, True); + if (!pdb_set_logon_script(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_profile_path(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_profile_path(user, sam_subst, True); + if (!pdb_set_profile_path(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_homedir(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_homedir(user, sam_subst, True); + if (!pdb_set_homedir(user, sam_subst, True)) return False; } else { DEBUG(0,("pdb_getsampwent: getpwnam(%s) return NULL. User does not exist!\n", diff --git a/source/rpcclient/cmd_spoolss.c b/source/rpcclient/cmd_spoolss.c index ed656323440..f0e6af9822c 100644 --- a/source/rpcclient/cmd_spoolss.c +++ b/source/rpcclient/cmd_spoolss.c @@ -1183,11 +1183,15 @@ static NTSTATUS cmd_spoolss_getprintprocdir(struct cli_state *cli, return NT_STATUS_OK; } - asprintf(&servername, "\\\\%s", cli->desthost); + if (asprintf(&servername, "\\\\%s", cli->desthost) < 0) + return NT_STATUS_NO_MEMORY; strupper(servername); - asprintf(&environment, "%s", (argc == 3) ? argv[2] : - PRINTER_DRIVER_ARCHITECTURE); + if (asprintf(&environment, "%s", (argc == 3) ? argv[2] : + PRINTER_DRIVER_ARCHITECTURE) < 0) { + SAFE_FREE(servername); + return NT_STATUS_NO_MEMORY; + } result = cli_spoolss_getprintprocessordirectory( cli, mem_ctx, servername, environment, procdir); |