summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-28 13:19:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:04:55 -0500
commita6ae640313a47ac2950c0948e4385fa934a5ef09 (patch)
tree3cc3cb8ec8c8cec020e85cd28e91c7dba128addf /source4/lib
parente481385391a25c19d82ce93fbec11a973cf82e9f (diff)
downloadsamba-a6ae640313a47ac2950c0948e4385fa934a5ef09.tar.gz
samba-a6ae640313a47ac2950c0948e4385fa934a5ef09.tar.bz2
samba-a6ae640313a47ac2950c0948e4385fa934a5ef09.zip
r3323: more warning reductions
(This used to be commit 5921587ec26e4892efc678421277e4969417d7f5)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/cmdline/readline.c2
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c4
-rw-r--r--source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c6
-rw-r--r--source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c12
-rw-r--r--source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c28
-rw-r--r--source4/lib/registry/reg_backend_w95/reg_backend_w95.c9
-rw-r--r--source4/lib/time.c12
7 files changed, 27 insertions, 46 deletions
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));