diff options
author | Jeremy Allison <jra@samba.org> | 2003-06-27 20:55:48 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-06-27 20:55:48 +0000 |
commit | 0e983b32fd309de24b923a5c4928635c6c03e89f (patch) | |
tree | 6630f255098fd23e0b0b39f6410f86bb7c682077 /source3 | |
parent | 8d31403fe831684daaa45d2784c36ab14e3a822a (diff) | |
download | samba-0e983b32fd309de24b923a5c4928635c6c03e89f.tar.gz samba-0e983b32fd309de24b923a5c4928635c6c03e89f.tar.bz2 samba-0e983b32fd309de24b923a5c4928635c6c03e89f.zip |
Some const correctness. Stop tdb being used as a remote backend. If an
idmap backend is specified cause smbd to ask winbindd (use winbindd if
you want a consistant remote backend solution).
Should work well enough for next beta now...
Jeremy.
(This used to be commit 8f830c509af5976d988a30f0b0aee4ec61dd97a3)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nsswitch/winbindd.c | 2 | ||||
-rw-r--r-- | source3/printing/notify.c | 2 | ||||
-rw-r--r-- | source3/sam/idmap.c | 131 | ||||
-rw-r--r-- | source3/sam/idmap_tdb.c | 2 | ||||
-rw-r--r-- | source3/sam/idmap_winbind.c | 1 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 10 | ||||
-rw-r--r-- | source3/smbd/server.c | 8 | ||||
-rw-r--r-- | source3/utils/net_idmap.c | 2 | ||||
-rw-r--r-- | source3/utils/pdbedit.c | 2 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 49 |
10 files changed, 114 insertions, 95 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 85403eedeb..ff9d0b90b9 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -845,7 +845,7 @@ int main(int argc, char **argv) if (!winbindd_upgrade_idmap()) return 1; - if (!idmap_init()) + if (!idmap_init(lp_idmap_backend())) return 1; if (!idmap_init_wellknown_sids()) diff --git a/source3/printing/notify.c b/source3/printing/notify.c index ee973da211..479d883134 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -480,7 +480,7 @@ void notify_printer_location(int snum, char *location) snum, strlen(location) + 1, location); } -void notify_printer_byname( char *printername, uint32 change, char *value ) +void notify_printer_byname( const char *printername, uint32 change, char *value ) { int snum = print_queue_snum(printername); int type = PRINTER_NOTIFY_TYPE; diff --git a/source3/sam/idmap.c b/source3/sam/idmap.c index 25a3c2ba94..7e50fe1906 100644 --- a/source3/sam/idmap.c +++ b/source3/sam/idmap.c @@ -4,6 +4,7 @@ Copyright (C) Tim Potter 2000 Copyright (C) Anthony Liguori <aliguor@us.ibm.com> 2003 Copyright (C) Simo Sorce 2003 + Copyright (C) Jeremy Allison 2003. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,37 +33,37 @@ struct idmap_function_entry { static struct idmap_function_entry *backends = NULL; -static struct idmap_methods *local_map; +static struct idmap_methods *cache_map; static struct idmap_methods *remote_map; -static void lazy_initialize_idmap(void) -{ - static BOOL initialized = False; +/********************************************************************** + Get idmap methods. Don't allow tdb to be a remote method. +**********************************************************************/ - if(!initialized) { - idmap_init(); - initialized = True; - } -} - -static struct idmap_methods *get_methods(const char *name) +static struct idmap_methods *get_methods(const char *name, BOOL cache_method) { struct idmap_function_entry *entry = backends; - while(entry) { - if (strcmp(entry->name, name) == 0) return entry->methods; - entry = entry->next; + for(entry = backends; entry; entry = entry->next) { + if (!cache_method && strequal(entry->name, "tdb")) + continue; /* tdb is only cache method. */ + if (strequal(entry->name, name)) + return entry->methods; } return NULL; } +/********************************************************************** + Allow a module to register itself as a method. +**********************************************************************/ + NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods *methods) { struct idmap_function_entry *entry; if ((version != SMB_IDMAP_INTERFACE_VERSION)) { - DEBUG(0, ("Failed to register idmap module.\n" + DEBUG(0, ("smb_register_idmap: Failed to register idmap module.\n" "The module was compiled against SMB_IDMAP_INTERFACE_VERSION %d,\n" "current SMB_IDMAP_INTERFACE_VERSION is %d.\n" "Please recompile against the current version of samba!\n", @@ -71,12 +72,12 @@ NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods } if (!name || !name[0] || !methods) { - DEBUG(0,("smb_register_idmap() called with NULL pointer or empty name!\n")); + DEBUG(0,("smb_register_idmap: called with NULL pointer or empty name!\n")); return NT_STATUS_INVALID_PARAMETER; } - if (get_methods(name)) { - DEBUG(0,("idmap module %s already registered!\n", name)); + if (get_methods(name, False)) { + DEBUG(0,("smb_register_idmap: idmap module %s already registered!\n", name)); return NT_STATUS_OBJECT_NAME_COLLISION; } @@ -85,67 +86,73 @@ NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods entry->methods = methods; DLIST_ADD(backends, entry); - DEBUG(5, ("Successfully added idmap backend '%s'\n", name)); + DEBUG(5, ("smb_register_idmap: Successfully added idmap backend '%s'\n", name)); return NT_STATUS_OK; } -/* Initialize backend */ -BOOL idmap_init(void) -{ - const char *remote_backend = lp_idmap_backend(); +/********************************************************************** + Initialise idmap cache and a remote backend (if configured). +**********************************************************************/ +BOOL idmap_init(const char *remote_backend) +{ if (!backends) static_init_idmap; - if (!local_map) { - local_map = get_methods("tdb"); + if (!cache_map) { + cache_map = get_methods("tdb", True); - if (!local_map) { - DEBUG(0, ("idmap_init: could not find tdb backend!\n")); + if (!cache_map) { + DEBUG(0, ("idmap_init: could not find tdb cache backend!\n")); return False; } - if (!NT_STATUS_IS_OK(local_map->init( NULL ))) { - DEBUG(0, ("idmap_init: could not load or create local backend!\n")); + if (!NT_STATUS_IS_OK(cache_map->init( NULL ))) { + DEBUG(0, ("idmap_init: could not initialise tdb cache backend!\n")); return False; } } if (!remote_map && remote_backend && *remote_backend != 0) { + char *rem_backend = smb_xstrdup(remote_backend); fstring params = ""; char *pparams; /* get any mode parameters passed in */ - if ( (pparams = strchr( remote_backend, ':' )) != NULL ) { + if ( (pparams = strchr( rem_backend, ':' )) != NULL ) { *pparams = '\0'; pparams++; fstrcpy( params, pparams ); } - DEBUG(3, ("idmap_init: using '%s' as remote backend\n", remote_backend)); + DEBUG(3, ("idmap_init: using '%s' as remote backend\n", rem_backend)); - if((remote_map = get_methods(remote_backend)) || - (NT_STATUS_IS_OK(smb_probe_module("idmap", remote_backend)) && - (remote_map = get_methods(remote_backend)))) { + if((remote_map = get_methods(rem_backend, False)) || + (NT_STATUS_IS_OK(smb_probe_module("idmap", rem_backend)) && + (remote_map = get_methods(rem_backend, False)))) { remote_map->init(params); } else { - DEBUG(0, ("idmap_init: could not load remote backend '%s'\n", remote_backend)); + DEBUG(0, ("idmap_init: could not load remote backend '%s'\n", rem_backend)); + SAFE_FREE(rem_backend); return False; } - + SAFE_FREE(rem_backend); } return True; } +/************************************************************************** + This is a rare operation, designed to allow an explicit mapping to be + set up for a sid to a POSIX id. Usually called to set up mappings for groups. +**************************************************************************/ + NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type) { NTSTATUS ret; - lazy_initialize_idmap(); - - ret = local_map->set_mapping(sid, id, id_type); + ret = cache_map->set_mapping(sid, id, id_type); if (!NT_STATUS_IS_OK(ret)) { DEBUG (0, ("idmap_set_mapping: Error, unable to modify local cache!\n")); DEBUGADD(0, ("Error: %s", nt_errstr(ret))); @@ -165,19 +172,21 @@ NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type) return ret; } -/* Get ID from SID */ +/************************************************************************** + Get ID from SID. This can create a mapping for a SID to a POSIX id. +**************************************************************************/ + NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) { NTSTATUS ret; int loc_type; - lazy_initialize_idmap(); - loc_type = *id_type; - if (remote_map) { /* We have a central remote idmap */ + if (remote_map) { + /* We have a central remote idmap so only look in cache not set. */ loc_type |= ID_QUERY_ONLY; } - ret = local_map->get_id_from_sid(id, &loc_type, sid); + ret = cache_map->get_id_from_sid(id, &loc_type, sid); if (!NT_STATUS_IS_OK(ret)) { if (remote_map) { ret = remote_map->get_id_from_sid(id, id_type, sid); @@ -185,6 +194,7 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) DEBUG(3, ("idmap_get_id_from_sid: error fetching id!\n")); return ret; } else { + /* The remote backend gave us a valid mapping, cache it. */ loc_type |= ID_CACHE_SAVE; idmap_set_mapping(sid, *id, loc_type); } @@ -196,19 +206,20 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) return ret; } -/* Get SID from ID */ +/************************************************************************** + Get SID from ID. This must have been created before. +**************************************************************************/ + NTSTATUS idmap_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type) { NTSTATUS ret; int loc_type; - lazy_initialize_idmap(); - loc_type = id_type; if (remote_map) { loc_type = id_type | ID_QUERY_ONLY; } - ret = local_map->get_sid_from_id(sid, id, loc_type); + ret = cache_map->get_sid_from_id(sid, id, loc_type); if (!NT_STATUS_IS_OK(ret)) { if (remote_map) { ret = remote_map->get_sid_from_id(sid, id, id_type); @@ -216,8 +227,9 @@ NTSTATUS idmap_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type) DEBUG(3, ("idmap_get_sid_from_id: unable to fetch sid!\n")); return ret; } else { + /* The remote backend gave us a valid mapping, cache it. */ loc_type |= ID_CACHE_SAVE; - idmap_set_mapping(sid, id, loc_type); + ret = cache_map->set_mapping(sid, id, loc_type); } } } @@ -225,14 +237,17 @@ NTSTATUS idmap_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type) return ret; } -/* Close backend */ +/************************************************************************** + Shutdown maps. +**************************************************************************/ + NTSTATUS idmap_close(void) { NTSTATUS ret; - ret = local_map->close(); + ret = cache_map->close(); if (!NT_STATUS_IS_OK(ret)) { - DEBUG(3, ("idmap_close: failed to close local cache!\n")); + DEBUG(3, ("idmap_close: failed to close local tdb cache!\n")); } if (remote_map) { @@ -245,11 +260,13 @@ NTSTATUS idmap_close(void) return ret; } -/* Dump backend status */ +/************************************************************************** + Dump backend status. +**************************************************************************/ + void idmap_status(void) { - lazy_initialize_idmap(); - - local_map->status(); - if (remote_map) remote_map->status(); + cache_map->status(); + if (remote_map) + remote_map->status(); } diff --git a/source3/sam/idmap_tdb.c b/source3/sam/idmap_tdb.c index c30443f6da..18a082cb84 100644 --- a/source3/sam/idmap_tdb.c +++ b/source3/sam/idmap_tdb.c @@ -393,7 +393,7 @@ static NTSTATUS db_set_mapping(const DOM_SID *sid, unid_t id, int id_type) /* Lock the record for this SID. */ if (tdb_chainlock(idmap_tdb, ksid) != 0) { - DEBUG(10,("db_get_id_from_sid: failed to lock record %s. Error %s\n", + DEBUG(10,("db_set_mapping: failed to lock record %s. Error %s\n", ksidstr, tdb_errorstr(idmap_tdb) )); return NT_STATUS_UNSUCCESSFUL; } diff --git a/source3/sam/idmap_winbind.c b/source3/sam/idmap_winbind.c index 6c0d80ab1c..159071e292 100644 --- a/source3/sam/idmap_winbind.c +++ b/source3/sam/idmap_winbind.c @@ -157,7 +157,6 @@ static struct idmap_methods winbind_methods = { db_set_mapping, db_close, db_status - }; NTSTATUS idmap_winbind_init(void) diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 0030acc78b..13692d3c2c 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1753,7 +1753,7 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou but works ok like this --metze */ - DEBUG(1,("FSCTL_GET_REPARSE_POINT: fnum=%d control=0x%08x\n",fnum,control)); + DEBUG(10,("FSCTL_GET_REPARSE_POINT: fnum=%d control=0x%08x\n",fnum,control)); send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, NULL, 0, NULL, 0); return -1; @@ -1762,7 +1762,7 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou * --metze */ - DEBUG(1,("FSCTL_GET_REPARSE_POINT: fnum=%d control=0x%08x\n",fnum,control)); + DEBUG(10,("FSCTL_GET_REPARSE_POINT: fnum=%d control=0x%08x\n",fnum,control)); send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_NOT_A_REPARSE_POINT, NULL, 0, NULL, 0); return -1; @@ -1771,7 +1771,7 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou * --metze */ - DEBUG(1,("FSCTL_SET_REPARSE_POINT: fnum=%d control=0x%08x\n",fnum,control)); + DEBUG(10,("FSCTL_SET_REPARSE_POINT: fnum=%d control=0x%08x\n",fnum,control)); send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_NOT_A_REPARSE_POINT, NULL, 0, NULL, 0); return -1; @@ -1788,14 +1788,14 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou uid_t uid; size_t sid_len=SID_MAX_SIZE; - DEBUG(1,("FSCTL_FIND_FILES_BY_SID: fnum=%d control=0x%08x\n",fnum,control)); + DEBUG(10,("FSCTL_FIND_FILES_BY_SID: fnum=%d control=0x%08x\n",fnum,control)); /* this is not the length of the sid :-( so unknown 4 bytes */ /*sid_len = IVAL(pdata,0); DEBUGADD(0,("sid_len: (%u)\n",sid_len));*/ sid_parse(pdata+4,sid_len,&sid); - DEBUGADD(2,("SID: %s\n",sid_string_static(&sid))); + DEBUGADD(10,("SID: %s\n",sid_string_static(&sid))); if (!NT_STATUS_IS_OK(sid_to_uid(&sid, &uid))) { DEBUG(0,("sid_to_uid: failed, sid[%s]\n", diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 24cfed5be9..a767014232 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -845,8 +845,12 @@ void build_options(BOOL screen); if(!initialize_password_db(False)) exit(1); - if (!idmap_init()) - exit(1); + { + const char *idmap_back = lp_idmap_backend(); + + if (!idmap_init((idmap_back && *idmap_back) ? "winbind" : NULL)) + exit(1); + } if (!idmap_init_wellknown_sids()) exit(1); diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index 0fea4311ec..689d4ff813 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -75,7 +75,7 @@ static int net_idmap_dump(int argc, const char **argv) **********************************************************/ static int net_idmap_restore(int argc, const char **argv) { - if (!idmap_init()) { + if (!idmap_init(lp_idmap_backend())) { d_printf("Could not init idmap\n"); return -1; } diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index aa11f2bfdf..3fa2751347 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -609,7 +609,7 @@ int main (int argc, char **argv) if (!init_names()) exit(1); - if (!idmap_init()) + if (!idmap_init(lp_idmap_backend())) exit(1); if (!idmap_init_wellknown_sids()) diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 06add6af22..e168cf7837 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -34,7 +34,7 @@ static int num_replies; /* Used by message callback fns */ /* Send a message to a destination pid. Zero means broadcast smbd. */ -static BOOL send_message(pid_t pid, int msg_type, void *buf, int len, +static BOOL send_message(pid_t pid, int msg_type, const void *buf, int len, BOOL duplicates) { TDB_CONTEXT *tdb; @@ -92,7 +92,7 @@ static void print_string_cb(int msg_type, pid_t pid, void *buf, size_t len) /* Send no message. Useful for testing. */ -static BOOL do_noop(const pid_t pid, const int argc, char **argv) +static BOOL do_noop(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> noop\n"); @@ -106,7 +106,7 @@ static BOOL do_noop(const pid_t pid, const int argc, char **argv) /* Send a debug string */ -static BOOL do_debug(const pid_t pid, const int argc, char **argv) +static BOOL do_debug(const pid_t pid, const int argc, const char **argv) { if (argc != 2) { fprintf(stderr, "Usage: smbcontrol <dest> debug " @@ -120,7 +120,7 @@ static BOOL do_debug(const pid_t pid, const int argc, char **argv) /* Force a browser election */ -static BOOL do_election(const pid_t pid, const int argc, char **argv) +static BOOL do_election(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> force-election\n"); @@ -139,7 +139,7 @@ static void pong_cb(int msg_type, pid_t pid, void *buf, size_t len) num_replies++; } -static BOOL do_ping(const pid_t pid, const int argc, char **argv) +static BOOL do_ping(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> ping\n"); @@ -167,7 +167,7 @@ static BOOL do_ping(const pid_t pid, const int argc, char **argv) /* Set profiling options */ -static BOOL do_profile(const pid_t pid, const int argc, char **argv) +static BOOL do_profile(const pid_t pid, const int argc, const char **argv) { int v; @@ -239,7 +239,7 @@ static void profilelevel_rqst(int msg_type, pid_t pid, void *buf, size_t len) send_message(pid, MSG_PROFILELEVEL, &v, sizeof(int), False); } -static BOOL do_profilelevel(const pid_t pid, const int argc, char **argv) +static BOOL do_profilelevel(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> profilelevel\n"); @@ -268,7 +268,7 @@ static BOOL do_profilelevel(const pid_t pid, const int argc, char **argv) /* Display debug level settings */ -static BOOL do_debuglevel(const pid_t pid, const int argc, char **argv) +static BOOL do_debuglevel(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> debuglevel\n"); @@ -296,9 +296,9 @@ static BOOL do_debuglevel(const pid_t pid, const int argc, char **argv) /* Send a print notify message */ -static BOOL do_printnotify(const pid_t pid, const int argc, char **argv) +static BOOL do_printnotify(const pid_t pid, const int argc, const char **argv) { - char *cmd; + const char *cmd; /* Check for subcommand */ @@ -434,7 +434,7 @@ send: /* Close a share */ -static BOOL do_closeshare(const pid_t pid, const int argc, char **argv) +static BOOL do_closeshare(const pid_t pid, const int argc, const char **argv) { if (argc != 2) { fprintf(stderr, "Usage: smbcontrol <dest> close-share " @@ -448,7 +448,7 @@ static BOOL do_closeshare(const pid_t pid, const int argc, char **argv) /* Force a SAM synchronisation */ -static BOOL do_samsync(const pid_t pid, const int argc, char **argv) +static BOOL do_samsync(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> samsync\n"); @@ -461,7 +461,7 @@ static BOOL do_samsync(const pid_t pid, const int argc, char **argv) /* Force a SAM replication */ -static BOOL do_samrepl(const pid_t pid, const int argc, char **argv) +static BOOL do_samrepl(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> samrepl\n"); @@ -474,7 +474,7 @@ static BOOL do_samrepl(const pid_t pid, const int argc, char **argv) /* Display talloc pool usage */ -static BOOL do_poolusage(const pid_t pid, const int argc, char **argv) +static BOOL do_poolusage(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> pool-usage\n"); @@ -502,7 +502,7 @@ static BOOL do_poolusage(const pid_t pid, const int argc, char **argv) /* Perform a dmalloc mark */ -static BOOL do_dmalloc_mark(const pid_t pid, const int argc, char **argv) +static BOOL do_dmalloc_mark(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> dmalloc-mark\n"); @@ -515,8 +515,7 @@ static BOOL do_dmalloc_mark(const pid_t pid, const int argc, char **argv) /* Perform a dmalloc changed */ -static BOOL do_dmalloc_changed(const pid_t pid, const int argc, - char **argv) +static BOOL do_dmalloc_changed(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> " @@ -530,7 +529,7 @@ static BOOL do_dmalloc_changed(const pid_t pid, const int argc, /* Shutdown a server process */ -static BOOL do_shutdown(const pid_t pid, const int argc, char **argv) +static BOOL do_shutdown(const pid_t pid, const int argc, const char **argv) { if (argc != 1) { fprintf(stderr, "Usage: smbcontrol <dest> shutdown\n"); @@ -542,7 +541,7 @@ static BOOL do_shutdown(const pid_t pid, const int argc, char **argv) /* Notify a driver upgrade */ -static BOOL do_drvupgrade(const pid_t pid, const int argc, char **argv) +static BOOL do_drvupgrade(const pid_t pid, const int argc, const char **argv) { if (argc != 2) { fprintf(stderr, "Usage: smbcontrol <dest> drvupgrade " @@ -558,7 +557,7 @@ static BOOL do_drvupgrade(const pid_t pid, const int argc, char **argv) static const struct { const char *name; /* Option name */ - BOOL (*fn)(const pid_t pid, const int argc, char **argv); + BOOL (*fn)(const pid_t pid, const int argc, const char **argv); const char *help; /* Short help text */ } msg_types[] = { { "debug", do_debug, "Set debuglevel" }, @@ -613,7 +612,7 @@ static void usage(poptContext *pc) /* Return the pid number for a string destination */ -static pid_t parse_dest(char *dest) +static pid_t parse_dest(const char *dest) { pid_t pid; @@ -644,9 +643,9 @@ static pid_t parse_dest(char *dest) /* Execute smbcontrol command */ -static BOOL do_command(int argc, char **argv) +static BOOL do_command(int argc, const char **argv) { - char *dest = argv[0], *command = argv[1]; + const char *dest = argv[0], *command = argv[1]; pid_t pid; int i; @@ -669,7 +668,7 @@ static BOOL do_command(int argc, char **argv) /* Main program */ -int main(int argc, char **argv) +int main(int argc, const char **argv) { poptContext pc; int opt; @@ -726,7 +725,7 @@ int main(int argc, char **argv) argv. The argc parameter should have been decremented to the correct value in the above switch statement. */ - argv = (char **)poptGetArgs(pc); + argv = (const char **)poptGetArgs(pc); argc--; /* Don't forget about argv[0] */ if (argc == 1) |