mirror of
https://github.com/samba-team/samba.git
synced 2025-01-14 19:24:43 +03:00
Add const (from a patch by Stephan Kulow <coolo@kde.org>)
(This used to be commit 8b5ad24231e5001e612c5fd4bbde2762caef5856)
This commit is contained in:
parent
35d546ecd1
commit
494f339ca8
@ -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,
|
typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv,
|
||||||
char * server, char * share,
|
const char * server, const char * share,
|
||||||
char * workgroup, char * username);
|
const char * workgroup, const char * username);
|
||||||
|
|
||||||
|
|
||||||
/**@ingroup callback
|
/**@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.
|
* @return pointer to SMBCSRV on success. NULL on failure.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, char * server,
|
typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server,
|
||||||
char * share, char * workgroup, char * username);
|
const char * share, const char * workgroup,
|
||||||
|
const char * username);
|
||||||
|
|
||||||
|
|
||||||
/**@ingroup callback
|
/**@ingroup callback
|
||||||
|
@ -50,8 +50,8 @@ struct smbc_server_cache {
|
|||||||
* This function is only used if the external cache is not enabled
|
* This function is only used if the external cache is not enabled
|
||||||
*/
|
*/
|
||||||
static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
|
static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
|
||||||
char * server, char * share,
|
const char * server, const char * share,
|
||||||
char * workgroup, char * username)
|
const char * workgroup, const char * username)
|
||||||
{
|
{
|
||||||
struct smbc_server_cache * srvcache = NULL;
|
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)
|
* returns server_fd on success, -1 on error (not found)
|
||||||
* This function is only used if the external cache is not enabled
|
* This function is only used if the external cache is not enabled
|
||||||
*/
|
*/
|
||||||
static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, char * server,
|
static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, const char * server,
|
||||||
char * share, char * workgroup, char * user)
|
const char * share, const char * workgroup, const char * user)
|
||||||
{
|
{
|
||||||
struct smbc_server_cache * srv = NULL;
|
struct smbc_server_cache * srv = NULL;
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SMBCSRV *smbc_server(SMBCCTX *context,
|
SMBCSRV *smbc_server(SMBCCTX *context,
|
||||||
char *server, char *share,
|
const char *server, const char *share,
|
||||||
char *workgroup, char *username,
|
char *workgroup, char *username,
|
||||||
char *password)
|
char *password)
|
||||||
{
|
{
|
||||||
@ -358,7 +358,8 @@ SMBCSRV *smbc_server(SMBCCTX *context,
|
|||||||
int auth_called = 0;
|
int auth_called = 0;
|
||||||
struct cli_state c;
|
struct cli_state c;
|
||||||
struct nmb_name called, calling;
|
struct nmb_name called, calling;
|
||||||
char *p, *server_n = server;
|
char *p;
|
||||||
|
const char *server_n = server;
|
||||||
fstring group;
|
fstring group;
|
||||||
pstring ipenv;
|
pstring ipenv;
|
||||||
struct in_addr ip;
|
struct in_addr ip;
|
||||||
@ -1524,27 +1525,27 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
|
|||||||
if (!context || !context->internal ||
|
if (!context || !context->internal ||
|
||||||
!context->internal->_initialized) {
|
!context->internal->_initialized) {
|
||||||
|
|
||||||
fprintf(stderr, "no valid context\n");
|
DEBUG(4, ("no valid context\n"));
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fname) {
|
if (!fname) {
|
||||||
fprintf(stderr, "no valid fname\n");
|
DEBUG(4, ("no valid fname\n"));
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smbc_parse_path(context, fname, server, share, path, user, password)) {
|
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;
|
errno = EINVAL;
|
||||||
return NULL;
|
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);
|
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) {
|
if (server[0] == (char)0) {
|
||||||
struct in_addr server_ip;
|
struct in_addr server_ip;
|
||||||
|
|
||||||
fprintf(stderr, "empty server\n");
|
DEBUG(4, ("empty server\n"));
|
||||||
|
|
||||||
if (share[0] != (char)0 || path[0] != (char)0) {
|
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;
|
errno = EINVAL;
|
||||||
if (dir) {
|
if (dir) {
|
||||||
SAFE_FREE(dir->fname);
|
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);
|
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) {
|
if (!context->workgroup) {
|
||||||
@ -2771,7 +2772,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
|
|||||||
context->workgroup = strdup("samba");
|
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 */
|
/* shortest timeout is 1 second */
|
||||||
if (context->timeout > 0 && context->timeout < 1000)
|
if (context->timeout > 0 && context->timeout < 1000)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user