summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-04-02 17:04:33 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-04-02 17:04:33 +0000
commit494f339ca8c726e1c91ce95c61eae2cb765c35b5 (patch)
tree4d48d73e4d0ecfbfb1279f0fb791275743bf2368
parent35d546ecd1efee9b5284cdbb9680363223d34a6d (diff)
downloadsamba-494f339ca8c726e1c91ce95c61eae2cb765c35b5.tar.gz
samba-494f339ca8c726e1c91ce95c61eae2cb765c35b5.tar.bz2
samba-494f339ca8c726e1c91ce95c61eae2cb765c35b5.zip
Add const (from a patch by Stephan Kulow <coolo@kde.org>)
(This used to be commit 8b5ad24231e5001e612c5fd4bbde2762caef5856)
-rw-r--r--source3/include/libsmbclient.h9
-rw-r--r--source3/libsmb/libsmb_cache.c8
-rw-r--r--source3/libsmb/libsmbclient.c21
3 files changed, 20 insertions, 18 deletions
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index 0c905edcbc..a9f83cfbd3 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -257,8 +257,8 @@ typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv);
*
*/
typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv,
- char * server, char * share,
- char * workgroup, char * username);
+ const char * server, const char * share,
+ const char * workgroup, const char * username);
/**@ingroup callback
@@ -277,8 +277,9 @@ typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv,
* @return pointer to SMBCSRV on success. NULL on failure.
*
*/
-typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, char * server,
- char * share, char * workgroup, char * username);
+typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server,
+ const char * share, const char * workgroup,
+ const char * username);
/**@ingroup callback
diff --git a/source3/libsmb/libsmb_cache.c b/source3/libsmb/libsmb_cache.c
index b1620042f3..67dc686b48 100644
--- a/source3/libsmb/libsmb_cache.c
+++ b/source3/libsmb/libsmb_cache.c
@@ -50,8 +50,8 @@ struct smbc_server_cache {
* This function is only used if the external cache is not enabled
*/
static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
- char * server, char * share,
- char * workgroup, char * username)
+ const char * server, const char * share,
+ const char * workgroup, const char * username)
{
struct smbc_server_cache * srvcache = NULL;
@@ -108,8 +108,8 @@ static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
* returns server_fd on success, -1 on error (not found)
* This function is only used if the external cache is not enabled
*/
-static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, char * server,
- char * share, char * workgroup, char * user)
+static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, const char * server,
+ const char * share, const char * workgroup, const char * user)
{
struct smbc_server_cache * srv = NULL;
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index f74a0be7f3..1da55ed4bd 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -350,7 +350,7 @@ int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv)
*/
SMBCSRV *smbc_server(SMBCCTX *context,
- char *server, char *share,
+ const char *server, const char *share,
char *workgroup, char *username,
char *password)
{
@@ -358,7 +358,8 @@ SMBCSRV *smbc_server(SMBCCTX *context,
int auth_called = 0;
struct cli_state c;
struct nmb_name called, calling;
- char *p, *server_n = server;
+ char *p;
+ const char *server_n = server;
fstring group;
pstring ipenv;
struct in_addr ip;
@@ -1524,27 +1525,27 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
if (!context || !context->internal ||
!context->internal->_initialized) {
- fprintf(stderr, "no valid context\n");
+ DEBUG(4, ("no valid context\n"));
errno = EINVAL;
return NULL;
}
if (!fname) {
- fprintf(stderr, "no valid fname\n");
+ DEBUG(4, ("no valid fname\n"));
errno = EINVAL;
return NULL;
}
if (smbc_parse_path(context, fname, server, share, path, user, password)) {
- fprintf(stderr, "no valid path\n");
+ DEBUG(4, ("no valid path\n"));
errno = EINVAL;
return NULL;
}
- fprintf(stderr, "parsed path: fname='%s' server='%s' share='%s' path='%s'\n", fname, server, share, path);
+ DEBUG(4, ("parsed path: fname='%s' server='%s' share='%s' path='%s'\n", fname, server, share, path));
if (user[0] == (char)0) fstrcpy(user, context->user);
@@ -1571,10 +1572,10 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
if (server[0] == (char)0) {
struct in_addr server_ip;
- fprintf(stderr, "empty server\n");
+ DEBUG(4, ("empty server\n"));
if (share[0] != (char)0 || path[0] != (char)0) {
- fprintf(stderr, "share %d path %d\n", share[0], path[0]);
+ DEBUG(4,("share %d path %d\n", share[0], path[0]));
errno = EINVAL;
if (dir) {
SAFE_FREE(dir->fname);
@@ -2759,7 +2760,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
slprintf(context->netbios_name, 16, "smbc%s%d", context->user, pid);
}
}
- DEBUG(0,("Using netbios name %s.\n", context->netbios_name));
+ DEBUG(1,("Using netbios name %s.\n", context->netbios_name));
if (!context->workgroup) {
@@ -2771,7 +2772,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
context->workgroup = strdup("samba");
}
}
- DEBUG(0,("Using workgroup %s.\n", context->workgroup));
+ DEBUG(1,("Using workgroup %s.\n", context->workgroup));
/* shortest timeout is 1 second */
if (context->timeout > 0 && context->timeout < 1000)