diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/client/client.c | 13 | ||||
-rw-r--r-- | source4/client/clitar.c | 14 | ||||
-rw-r--r-- | source4/lib/cmdline/readline.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 4 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c | 6 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c | 12 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c | 28 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_w95/reg_backend_w95.c | 9 | ||||
-rw-r--r-- | source4/lib/time.c | 12 | ||||
-rw-r--r-- | source4/libcli/auth/spnego_parse.c | 4 | ||||
-rw-r--r-- | source4/nsswitch/wb_common.c | 16 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_qfileinfo.c | 3 | ||||
-rw-r--r-- | source4/ntvfs/simple/vfs_simple.c | 49 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 2 | ||||
-rw-r--r-- | source4/torture/torture.c | 2 | ||||
-rw-r--r-- | source4/utils/net/net_time.c | 2 |
16 files changed, 73 insertions, 105 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index 823be51285..dce99a7833 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -697,7 +697,7 @@ static int do_get(char *rname, const char *lname, BOOL reget) GetTimeOfDay(&tp_start); if (lowercase) { - strlower(lname); + strlower(discard_const_p(char, lname)); } fnum = smbcli_open(cli->tree, rname, O_RDONLY, DENY_NONE); @@ -870,9 +870,10 @@ static void do_mget(file_info *finfo) pstrcat(cur_dir,finfo->name); pstrcat(cur_dir,"\\"); - string_replace(finfo->name, '\\', '/'); - if (lowercase) - strlower(finfo->name); + string_replace(discard_const_p(char, finfo->name), '\\', '/'); + if (lowercase) { + strlower(discard_const_p(char, finfo->name)); + } if (!directory_exist(finfo->name,NULL) && mkdir(finfo->name,0777) != 0) { @@ -2267,7 +2268,7 @@ static BOOL browse_host(const char *query_host) /**************************************************************************** try and browse available connections on a host ****************************************************************************/ -static BOOL list_servers(char *wk_grp) +static BOOL list_servers(const char *wk_grp) { d_printf("REWRITE: list servers not implemented\n"); return False; @@ -2636,7 +2637,7 @@ cleanup: /**************************************************************************** make sure we swallow keepalives during idle time ****************************************************************************/ -static void readline_callback(const char **cmd_ptr) +static void readline_callback(void) { static time_t last_t; time_t t; diff --git a/source4/client/clitar.c b/source4/client/clitar.c index 7797b686d5..e10a6b6698 100644 --- a/source4/client/clitar.c +++ b/source4/client/clitar.c @@ -40,10 +40,8 @@ /** Convert list of tokens to array; dependent on above routine. - Uses last_ptr from above - bit of a hack. **/ - -static char **toktocliplist(const char *ptr, int *ctok, const char *sep) +static char **toktocliplist(char *ptr, int *ctok, const char *sep) { char *s = ptr; int ictok=0; @@ -168,7 +166,7 @@ static int tarhandle; static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime, const char *amode, uint8_t ftype); -static void do_atar(char *rname,char *lname,file_info *finfo1); +static void do_atar(char *rname,const char *lname,file_info *finfo1); static void do_tar(file_info *finfo); static void oct_it(uint64_t value, int ndgs, char *p); static void fixtarname(char *tptr, const char *fp, int l); @@ -641,7 +639,7 @@ static void do_setrattr(char *name, uint16_t attr, int set) /**************************************************************************** append one remote file to the tar file ***************************************************************************/ -static void do_atar(char *rname,char *lname,file_info *finfo1) +static void do_atar(char *rname,const char *lname,file_info *finfo1) { int fnum; uint64_t nread=0; @@ -666,7 +664,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1) finfo.mtime = finfo1 -> mtime; finfo.atime = finfo1 -> atime; finfo.ctime = finfo1 -> ctime; - finfo.name = finfo1 -> name; + finfo.name = discard_const_p(char, finfo1 -> name); } else { ZERO_STRUCT(finfo); @@ -1443,13 +1441,13 @@ int cmd_setmode(const char **cmd_ptr) /**************************************************************************** Principal command for creating / extracting ***************************************************************************/ -int cmd_tar(const char **cmd_ptr) +int cmd_tar(char **cmd_ptr) { fstring buf; char **argl; int argcl; - if (!next_token(cmd_ptr,buf,NULL,sizeof(buf))) + if (!next_token((const char **)cmd_ptr,buf,NULL,sizeof(buf))) { DEBUG(0,("tar <c|x>[IXbgan] <filename>\n")); return 1; diff --git a/source4/lib/cmdline/readline.c b/source4/lib/cmdline/readline.c index 97201d00bb..83d476b0d1 100644 --- a/source4/lib/cmdline/readline.c +++ b/source4/lib/cmdline/readline.c @@ -51,7 +51,7 @@ ****************************************************************************/ static char *smb_readline_replacement(const char *prompt, void (*callback)(void), - char **(completion_fn)(const char *text, int start, int end)) + char **(completion_fn)(const char *text, int start, int end)) { fd_set fds; static pstring line; diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 5b682a493a..9ac51b26fe 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -252,7 +252,9 @@ static int lldb_search(struct ldb_context *ldb, const char *base, LDAPMessage *ldapres, *msg; lldb->last_rc = ldap_search_s(lldb->ldap, base, (int)scope, - expression, attrs, 0, &ldapres); + expression, + discard_const_p(char *, attrs), + 0, &ldapres); if (lldb->last_rc != LDAP_SUCCESS) { return -1; } diff --git a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c index d76b7715da..faa8a5e62c 100644 --- a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c @@ -57,12 +57,6 @@ static char *reg_path_to_ldb(TALLOC_CTX *mem_ctx, const char *path, const char * } -static int ldb_close_registry(void *data) -{ - ldb_close((struct ldb_context *)data); - return 0; -} - static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_key **subkey) { struct ldb_context *c = k->hive->backend_data; diff --git a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c index 14fff5b60d..805f95fca1 100644 --- a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c +++ b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c @@ -934,7 +934,7 @@ static WERROR vk_to_val(TALLOC_CTX *mem_ctx, struct registry_key *parent, VK_HDR if(tmp->data_type == REG_SZ) { char *ret; - dat_len = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, dtmp, dat_len, (const void **)&ret); + dat_len = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, dtmp, dat_len, (void **)&ret); dtmp = ret; } @@ -1571,16 +1571,6 @@ error: #endif -static WERROR nt_close_registry (struct registry_hive *h) -{ - REGF *regf = h->backend_data; - if (regf->base) munmap(regf->base, regf->sbuf.st_size); - regf->base = NULL; - close(regf->fd); /* Ignore the error :-) */ - - return WERR_OK; -} - static WERROR nt_open_hive (TALLOC_CTX *mem_ctx, struct registry_hive *h, struct registry_key **key) { REGF *regf; diff --git a/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c index c819eb4254..76c19d01ad 100644 --- a/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c +++ b/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c @@ -100,7 +100,8 @@ WERROR rpc_list_hives (TALLOC_CTX *mem_ctx, const char *location, const char *cr static WERROR rpc_open_hive(TALLOC_CTX *mem_ctx, struct registry_hive *h, struct registry_key **k) { NTSTATUS status; - char *user, *pass; + char *user; + char *pass; struct rpc_key_data *mykeydata; struct dcerpc_pipe *p; int n; @@ -114,18 +115,18 @@ static WERROR rpc_open_hive(TALLOC_CTX *mem_ctx, struct registry_hive *h, struct user = talloc_strdup(mem_ctx, h->credentials); pass = strchr(user, '%'); - if(pass) - { - *pass = '\0'; pass++; + if (pass) { + pass = strdup(pass+1); } else { - pass = ""; + pass = strdup(""); } status = dcerpc_pipe_connect(&p, h->location, - DCERPC_WINREG_UUID, - DCERPC_WINREG_VERSION, - lp_workgroup(), - user, pass); + DCERPC_WINREG_UUID, + DCERPC_WINREG_VERSION, + lp_workgroup(), + user, pass); + free(pass); h->backend_data = p; @@ -145,12 +146,7 @@ static WERROR rpc_open_hive(TALLOC_CTX *mem_ctx, struct registry_hive *h, struct return known_hives[n].open((struct dcerpc_pipe *)h->backend_data, *k, &(mykeydata->pol)); } -static WERROR rpc_close_registry(struct registry_hive *h) -{ - dcerpc_pipe_close((struct dcerpc_pipe *)h->backend_data); - return WERR_OK; -} - +#if 0 static WERROR rpc_key_put_rpc_data(TALLOC_CTX *mem_ctx, struct registry_key *k) { struct winreg_OpenKey r; @@ -173,7 +169,7 @@ static WERROR rpc_key_put_rpc_data(TALLOC_CTX *mem_ctx, struct registry_key *k) return r.out.result; } - +#endif static WERROR rpc_open_rel_key(TALLOC_CTX *mem_ctx, struct registry_key *h, const char *name, struct registry_key **key) { diff --git a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c index 2184a8855d..c285dac7c9 100644 --- a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c +++ b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c @@ -300,15 +300,6 @@ static WERROR w95_get_subkey_by_index (TALLOC_CTX *mem_ctx, struct registry_key return WERR_NO_MORE_ITEMS; } -static WERROR w95_close_reg(struct registry_hive *h) -{ - CREG *creg = h->backend_data; - if (creg->base) munmap(creg->base, creg->sbuf.st_size); - creg->base = NULL; - close(creg->fd); - return WERR_OK; -} - static WERROR w95_num_values(struct registry_key *k, int *count) { RGKN_KEY *rgkn_key = k->backend_data; diff --git a/source4/lib/time.c b/source4/lib/time.c index eae30f581b..5ea9b46844 100644 --- a/source4/lib/time.c +++ b/source4/lib/time.c @@ -310,7 +310,15 @@ char *ldap_timestring(TALLOC_CTX *mem_ctx, time_t t) tm->tm_sec); } - +/* + a hack to move the stupid gcc strftime warning to one place - see manual page +*/ +#ifdef HAVE_STRFTIME +size_t sys_strftime(char *s, size_t max, const char *fmt, const struct tm *tm) +{ + return strftime(s, max, fmt, tm); +} +#endif /**************************************************************************** Return the date and time as a string @@ -333,7 +341,7 @@ char *timestring(TALLOC_CTX *mem_ctx, time_t t) in the gcc warning, not a bug in this code. See a recent strftime() manual page for details. */ - strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm); + sys_strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm); TimeBuf = talloc_strdup(mem_ctx, tempTime); #else TimeBuf = talloc_strdup(mem_ctx, asctime(tm)); diff --git a/source4/libcli/auth/spnego_parse.c b/source4/libcli/auth/spnego_parse.c index 07dba61dde..12d3d05734 100644 --- a/source4/libcli/auth/spnego_parse.c +++ b/source4/libcli/auth/spnego_parse.c @@ -349,10 +349,6 @@ BOOL spnego_free_data(struct spnego_data *spnego) switch(spnego->type) { case SPNEGO_NEG_TOKEN_INIT: if (spnego->negTokenInit.mechTypes) { - int i; - for (i = 0; spnego->negTokenInit.mechTypes[i]; i++) { - talloc_free(spnego->negTokenInit.mechTypes[i]); - } talloc_free(spnego->negTokenInit.mechTypes); } data_blob_free(&spnego->negTokenInit.mechToken); diff --git a/source4/nsswitch/wb_common.c b/source4/nsswitch/wb_common.c index 2f112e8695..a26e430db4 100644 --- a/source4/nsswitch/wb_common.c +++ b/source4/nsswitch/wb_common.c @@ -599,14 +599,22 @@ NSS_STATUS winbindd_request(int req_type, BOOL winbind_off( void ) { - static char *s = WINBINDD_DONT_ENV "=1"; - +#if HAVE_SETENV + setenv(WINBINDD_DONT_ENV, "1", 1); + return True; +#else + static const char *s = WINBINDD_DONT_ENV "=1"; return putenv(s) != -1; +#endif } BOOL winbind_on( void ) { - static char *s = WINBINDD_DONT_ENV "=0"; - +#if HAVE_SETENV + setenv(WINBINDD_DONT_ENV, "0", 1); + return True; +#else + static const char *s = WINBINDD_DONT_ENV "=0"; return putenv(s) != -1; +#endif } diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index 04c196121a..db4951fff0 100644 --- a/source4/ntvfs/posix/pvfs_qfileinfo.c +++ b/source4/ntvfs/posix/pvfs_qfileinfo.c @@ -31,6 +31,9 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, struct pvfs_filename *name, union smb_fileinfo *info) { switch (info->generic.level) { + case RAW_FILEINFO_GENERIC: + return NT_STATUS_INVALID_LEVEL; + case RAW_FILEINFO_GETATTR: info->getattr.out.attrib = name->dos.attrib; info->getattr.out.size = name->st.st_size; diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c index faf8f17b78..379d24f848 100644 --- a/source4/ntvfs/simple/vfs_simple.c +++ b/source4/ntvfs/simple/vfs_simple.c @@ -508,43 +508,24 @@ static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs, { ssize_t ret; - CHECK_READ_ONLY(req); + if (wr->generic.level != RAW_WRITE_WRITEX) { + return ntvfs_map_write(req, wr, ntvfs); + } - switch (wr->generic.level) { - case RAW_WRITE_WRITEX: - ret = pwrite(wr->writex.in.fnum, - wr->writex.in.data, - wr->writex.in.count, - wr->writex.in.offset); - if (ret == -1) { - return map_nt_error_from_unix(errno); - } - - wr->writex.out.nwritten = ret; - wr->writex.out.remaining = 0; /* should fill this in? */ - - return NT_STATUS_OK; - - case RAW_WRITE_WRITE: - if (wr->write.in.count == 0) { - /* a truncate! */ - ret = ftruncate(wr->write.in.fnum, wr->write.in.offset); - } else { - ret = pwrite(wr->write.in.fnum, - wr->write.in.data, - wr->write.in.count, - wr->write.in.offset); - } - if (ret == -1) { - return map_nt_error_from_unix(errno); - } - - wr->write.out.nwritten = ret; + CHECK_READ_ONLY(req); - return NT_STATUS_OK; + ret = pwrite(wr->writex.in.fnum, + wr->writex.in.data, + wr->writex.in.count, + wr->writex.in.offset); + if (ret == -1) { + return map_nt_error_from_unix(errno); } - - return NT_STATUS_NOT_SUPPORTED; + + wr->writex.out.nwritten = ret; + wr->writex.out.remaining = 0; /* should fill this in? */ + + return NT_STATUS_OK; } /* diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index fd605fb955..59ea8321ff 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -238,7 +238,7 @@ NTSTATUS dcesrv_generic_session_key(struct dcesrv_connection *p, DATA_BLOB *session_key) { /* this took quite a few CPU cycles to find ... */ - session_key->data = "SystemLibraryDTC"; + session_key->data = discard_const_p(char, "SystemLibraryDTC"); session_key->length = 16; return NT_STATUS_OK; } diff --git a/source4/torture/torture.c b/source4/torture/torture.c index d969a51404..dfc6d6871e 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2247,7 +2247,7 @@ static BOOL parse_unc(const char *unc_name, char **hostname, char **sharename) -static void sigcont(void) +static void sigcont(int sig) { } diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index befb406e87..2efe8faffe 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -63,7 +63,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) ZERO_ARRAY(timestr); tm = localtime(&r.generic.out.time); - strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); + sys_strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); printf("%s\n",timestr); |