r25035: Fix some more warnings, use service pointer rather than service number in...
authorJelmer Vernooij <jelmer@samba.org>
Sat, 8 Sep 2007 16:46:30 +0000 (16:46 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:05:43 +0000 (15:05 -0500)
(This used to be commit df9cebcb97e20564359097148665bd519f31bc6f)

114 files changed:
source4/auth/auth.c
source4/auth/auth_util.c
source4/auth/gensec/gensec.c
source4/auth/gensec/gensec_gssapi.c
source4/auth/gensec/gensec_krb5.c
source4/auth/gensec/schannel_sign.c
source4/auth/kerberos/krb5_init_context.c
source4/auth/ntlmssp/ntlmssp_client.c
source4/auth/ntlmssp/ntlmssp_server.c
source4/client/cifsdd.c
source4/cluster/ctdb/ctdb_cluster.c
source4/cluster/ctdb/opendb_ctdb.c
source4/dsdb/repl/drepl_service.c
source4/dsdb/samdb/cracknames.c
source4/dsdb/samdb/ldb_modules/password_hash.c
source4/kdc/hdb-ldb.c
source4/lib/appweb/ejs/ejsLib.c
source4/lib/charset/iconv.c
source4/lib/db_wrap.c
source4/lib/dbwrap/dbwrap.c
source4/lib/events/events.c
source4/lib/ldb/tools/ad2oLschema.c
source4/lib/registry/tests/hive.c
source4/lib/registry/tests/registry.c
source4/lib/socket/socket.c
source4/lib/tls/tlscert.c
source4/lib/util/tests/strlist.c
source4/libcli/nbt/nbtsocket.c
source4/libcli/resolve/nbtlist.c
source4/libcli/smb2/request.c
source4/libnet/libnet_become_dc.c
source4/libnet/libnet_samdump.c
source4/librpc/ndr/ndr_compression.c
source4/nbt_server/packet.c
source4/nbt_server/register.c
source4/nbt_server/wins/wins_ldb.c
source4/nbt_server/wins/winsclient.c
source4/nbt_server/wins/winsdb.c
source4/nbt_server/wins/winsserver.c
source4/ntvfs/common/opendb.c
source4/ntvfs/common/opendb_tdb.c
source4/ntvfs/posix/pvfs_shortname.c
source4/ntvfs/sysdep/inotify.c
source4/param/loadparm.c
source4/param/param.h
source4/param/share_classic.c
source4/rpc_server/common/server_info.c
source4/rpc_server/remote/dcesrv_remote.c
source4/script/mkproto.pl
source4/scripting/ejs/ejsrpc.c
source4/scripting/ejs/smbcalls_config.c
source4/selftest/output/plain.pm
source4/smb_server/smb2/negprot.c
source4/smb_server/smb2/receive.c
source4/smb_server/smb2/tcon.c
source4/smbd/service_stream.c
source4/torture/auth/ntlmssp.c
source4/torture/ldap/cldap.c
source4/torture/libnet/libnet_BecomeDC.c
source4/torture/libnet/libnet_user.c
source4/torture/libnet/userinfo.c
source4/torture/libnet/userman.c
source4/torture/local/dbspeed.c
source4/torture/local/event.c
source4/torture/local/iconv.c
source4/torture/local/irpc.c
source4/torture/local/sddl.c
source4/torture/local/share.c
source4/torture/locktest.c
source4/torture/ndr/lsa.c
source4/torture/ndr/ndr.c
source4/torture/ndr/winreg.c
source4/torture/raw/acls.c
source4/torture/raw/composite.c
source4/torture/raw/context.c
source4/torture/raw/eas.c
source4/torture/raw/lock.c
source4/torture/raw/lockbench.c
source4/torture/raw/mkdir.c
source4/torture/raw/mux.c
source4/torture/raw/notify.c
source4/torture/raw/open.c
source4/torture/raw/pingpong.c
source4/torture/raw/qfsinfo.c
source4/torture/raw/read.c
source4/torture/raw/streams.c
source4/torture/raw/unlink.c
source4/torture/rpc/autoidl.c
source4/torture/rpc/bench.c
source4/torture/rpc/countcalls.c
source4/torture/rpc/drsuapi.c
source4/torture/rpc/dssync.c
source4/torture/rpc/echo.c
source4/torture/rpc/eventlog.c
source4/torture/rpc/lsa.c
source4/torture/rpc/netlogon.c
source4/torture/rpc/samba3rpc.c
source4/torture/rpc/samlogon.c
source4/torture/rpc/samr.c
source4/torture/rpc/samsync.c
source4/torture/rpc/schannel.c
source4/torture/rpc/session_key.c
source4/torture/rpc/svcctl.c
source4/torture/rpc/testjoin.c
source4/torture/smb2/connect.c
source4/torture/smb2/getinfo.c
source4/torture/smb2/util.c
source4/torture/ui.c
source4/torture/unix/whoami.c
source4/torture/util_smb.c
source4/utils/testparm.c
source4/web_server/http.c
source4/web_server/web_server.c
source4/wrepl_server/wrepl_server.c

index 8cd46cd6fe551b789461dd3f4450d06b7721f620..ba1e6fd0e54fd07f46abdd6ac6412af6db9a557f 100644 (file)
@@ -419,13 +419,13 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx,
        const char **auth_methods = NULL;
        switch (lp_server_role()) {
        case ROLE_STANDALONE:
-               auth_methods = lp_parm_string_list(-1, "auth methods", "standalone", NULL);
+               auth_methods = lp_parm_string_list(NULL, "auth methods", "standalone", NULL);
                break;
        case ROLE_DOMAIN_MEMBER:
-               auth_methods = lp_parm_string_list(-1, "auth methods", "member server", NULL);
+               auth_methods = lp_parm_string_list(NULL, "auth methods", "member server", NULL);
                break;
        case ROLE_DOMAIN_CONTROLLER:
-               auth_methods = lp_parm_string_list(-1, "auth methods", "domain controller", NULL);
+               auth_methods = lp_parm_string_list(NULL, "auth methods", "domain controller", NULL);
                break;
        }
        return auth_context_create_methods(mem_ctx, auth_methods, ev, msg, auth_ctx);
index 8398bbfaf47a0a7f057fbf22dfc46f706736661e..6597c79b848e1f949c927961cf3c1f95d451ff1b 100644 (file)
@@ -623,8 +623,9 @@ static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx,
 _PUBLIC_ NTSTATUS auth_system_session_info(TALLOC_CTX *parent_ctx, 
                                           struct auth_session_info **_session_info) 
 {
-       return _auth_system_session_info(parent_ctx, lp_parm_bool(-1,"system","anonymous", False), 
-                                        _session_info);
+       return _auth_system_session_info(parent_ctx, 
+                       lp_parm_bool(NULL, "system", "anonymous", false), 
+                       _session_info);
 }
 
 /*
index a974cd51381e43a36781cb4f53b233a14a084920..052eed1363d1daa8a1eb5004e34d2c081b159955 100644 (file)
@@ -1105,7 +1105,7 @@ _PUBLIC_ NTSTATUS gensec_set_target_hostname(struct gensec_security *gensec_secu
 _PUBLIC_ const char *gensec_get_target_hostname(struct gensec_security *gensec_security) 
 {
        /* We allow the target hostname to be overriden for testing purposes */
-       const char *target_hostname = lp_parm_string(-1, "gensec", "target_hostname");
+       const char *target_hostname = lp_parm_string(NULL, "gensec", "target_hostname");
        if (target_hostname) {
                return target_hostname;
        }
@@ -1203,7 +1203,7 @@ const char *gensec_get_target_principal(struct gensec_security *gensec_security)
 */
 NTSTATUS gensec_register(const struct gensec_security_ops *ops)
 {
-       if (!lp_parm_bool(-1, "gensec", ops->name, ops->enabled)) {
+       if (!lp_parm_bool(NULL, "gensec", ops->name, ops->enabled)) {
                DEBUG(2,("gensec subsystem %s is disabled\n", ops->name));
                return NT_STATUS_OK;
        }
index a3351f75a846670ad86e4ef50af7bc8a0b1d0fc1..8a7e8090ebb726c5fd1659d0f4e97cd562905ce6 100644 (file)
@@ -155,7 +155,7 @@ static NTSTATUS gensec_gssapi_start(struct gensec_security *gensec_security)
        
        gensec_gssapi_state->gss_exchange_count = 0;
        gensec_gssapi_state->max_wrap_buf_size
-               = lp_parm_int(-1, "gensec_gssapi", "max wrap buf size", 65536);
+               = lp_parm_int(NULL, "gensec_gssapi", "max wrap buf size", 65536);
                
        gensec_gssapi_state->sasl = False;
        gensec_gssapi_state->sasl_state = STAGE_GSS_NEG;
@@ -170,16 +170,16 @@ static NTSTATUS gensec_gssapi_start(struct gensec_security *gensec_security)
        gensec_gssapi_state->input_chan_bindings = GSS_C_NO_CHANNEL_BINDINGS;
        
        gensec_gssapi_state->want_flags = 0;
-       if (lp_parm_bool(-1, "gensec_gssapi", "mutual", True)) {
+       if (lp_parm_bool(NULL, "gensec_gssapi", "mutual", true)) {
                gensec_gssapi_state->want_flags |= GSS_C_MUTUAL_FLAG;
        }
-       if (lp_parm_bool(-1, "gensec_gssapi", "delegation", True)) {
+       if (lp_parm_bool(NULL, "gensec_gssapi", "delegation", true)) {
                gensec_gssapi_state->want_flags |= GSS_C_DELEG_FLAG;
        }
-       if (lp_parm_bool(-1, "gensec_gssapi", "replay", True)) {
+       if (lp_parm_bool(NULL, "gensec_gssapi", "replay", true)) {
                gensec_gssapi_state->want_flags |= GSS_C_REPLAY_FLAG;
        }
-       if (lp_parm_bool(-1, "gensec_gssapi", "sequence", True)) {
+       if (lp_parm_bool(NULL, "gensec_gssapi", "sequence", true)) {
                gensec_gssapi_state->want_flags |= GSS_C_SEQUENCE_FLAG;
        }
 
@@ -230,7 +230,7 @@ static NTSTATUS gensec_gssapi_start(struct gensec_security *gensec_security)
        }
 
        /* don't do DNS lookups of any kind, it might/will fail for a netbios name */
-       ret = gsskrb5_set_dns_canonicalize(lp_parm_bool(-1, "krb5", "set_dns_canonicalize", false));
+       ret = gsskrb5_set_dns_canonicalize(lp_parm_bool(NULL, "krb5", "set_dns_canonicalize", false));
        if (ret) {
                DEBUG(1,("gensec_krb5_start: gsskrb5_set_dns_canonicalize failed\n"));
                talloc_free(gensec_gssapi_state);
@@ -1317,7 +1317,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
                        talloc_free(mem_ctx);
                        return nt_status;
                }
-       } else if (!lp_parm_bool(-1, "gensec", "require_pac", False)) {
+       } else if (!lp_parm_bool(NULL, "gensec", "require_pac", false)) {
                DEBUG(1, ("Unable to find PAC, resorting to local user lookup: %s\n",
                          gssapi_error_string(mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid)));
                nt_status = sam_get_server_info_principal(mem_ctx, principal_string,
index 973de0c10bed302e99b2dd905d4cb1a740e1b503..c0348441edf7f0e9629de07853bf0e1f0d6c00fe 100644 (file)
@@ -582,7 +582,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
                                                      KRB5_AUTHDATA_WIN2K_PAC, 
                                                      &pac_data);
        
-       if (ret && lp_parm_bool(-1, "gensec", "require_pac", False)) {
+       if (ret && lp_parm_bool(NULL, "gensec", "require_pac", false)) {
                DEBUG(1, ("Unable to find PAC in ticket from %s, failing to allow access: %s \n",
                          principal_string,
                          smb_get_krb5_error_message(context, 
index 43de328c9e4b1a8d1c4eca8e9ee7e2901b6f38c7..1e57beba08974882bf5acdd9407129bef13aec80 100644 (file)
@@ -26,6 +26,7 @@
 #include "auth/gensec/schannel.h"
 #include "auth/credentials/credentials.h"
 #include "auth/gensec/gensec.h"
+#include "auth/gensec/schannel_proto.h"
 
 #define NETSEC_SIGN_SIGNATURE { 0x77, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }
 #define NETSEC_SEAL_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 }
index 000e715305a17e1d34a73f165376474e351b1f0b..06a80e44e48ce485e0c8febcd4fd1d7989b6a77b 100644 (file)
@@ -250,12 +250,12 @@ krb5_error_code smb_krb5_send_and_recv_func(krb5_context context,
                status = NT_STATUS_INVALID_PARAMETER;
                switch (hi->proto) {
                case KRB5_KRBHST_UDP:
-                       if (lp_parm_bool(-1, "krb5", "udp", True)) {
+                       if (lp_parm_bool(NULL, "krb5", "udp", true)) {
                                status = socket_create(name, SOCKET_TYPE_DGRAM, &smb_krb5->sock, 0);
                        }
                        break;
                case KRB5_KRBHST_TCP:
-                       if (lp_parm_bool(-1, "krb5", "tcp", True)) {
+                       if (lp_parm_bool(NULL, "krb5", "tcp", true)) {
                                status = socket_create(name, SOCKET_TYPE_STREAM, &smb_krb5->sock, 0);
                        }
                        break;
@@ -473,7 +473,7 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx,
        /* Set options in kerberos */
 
        krb5_set_dns_canonicalize_hostname((*smb_krb5_context)->krb5_context,
-                                          lp_parm_bool(-1, "krb5", "set_dns_canonicalize", false));
+                                          lp_parm_bool(NULL, "krb5", "set_dns_canonicalize", false));
 
        return 0;
 }
index a98918a54b7dfcaca2fb31ddc3cfc29e855bcca2..d2f28a394c87a79e5ac49559a41a2c44926e6d58 100644 (file)
@@ -299,13 +299,13 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
 
        gensec_ntlmssp_state->get_domain = lp_workgroup;
 
-       gensec_ntlmssp_state->unicode = lp_parm_bool(-1, "ntlmssp_client", "unicode", True);
+       gensec_ntlmssp_state->unicode = lp_parm_bool(NULL, "ntlmssp_client", "unicode", true);
 
-       gensec_ntlmssp_state->use_nt_response = lp_parm_bool(-1, "ntlmssp_client", "send_nt_reponse", True);
+       gensec_ntlmssp_state->use_nt_response = lp_parm_bool(NULL, "ntlmssp_client", "send_nt_reponse", true);
 
        gensec_ntlmssp_state->allow_lm_key = (lp_client_lanman_auth() 
-                                             && (lp_parm_bool(-1, "ntlmssp_client", "allow_lm_key", False)
-                                                 || lp_parm_bool(-1, "ntlmssp_client", "lm_key", False)));
+                                             && (lp_parm_bool(NULL, "ntlmssp_client", "allow_lm_key", false)
+                                                 || lp_parm_bool(NULL, "ntlmssp_client", "lm_key", false)));
 
        gensec_ntlmssp_state->use_ntlmv2 = lp_client_ntlmv2_auth();
 
@@ -315,27 +315,27 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
                NTLMSSP_NEGOTIATE_NTLM |
                NTLMSSP_REQUEST_TARGET;
 
-       if (lp_parm_bool(-1, "ntlmssp_client", "128bit", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_client", "128bit", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_128;               
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_client", "56bit", False)) {
+       if (lp_parm_bool(NULL, "ntlmssp_client", "56bit", false)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_56;                
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_client", "lm_key", False)) {
+       if (lp_parm_bool(NULL, "ntlmssp_client", "lm_key", false)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_LM_KEY;
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_client", "keyexchange", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_client", "keyexchange", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_KEY_EXCH;          
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_client", "alwayssign", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_client", "alwayssign", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN;               
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_client", "ntlm2", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_client", "ntlm2", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_NTLM2;             
        } else {
                /* apparently we can't do ntlmv2 if we don't do ntlm2 */
index 8b6920c97817e49bc3391600a094d31b63f53c3f..954c9ea2ac8339b37556f0bb5167b893e0b3ad5a 100644 (file)
@@ -751,7 +751,7 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
        gensec_ntlmssp_state->expected_state = NTLMSSP_NEGOTIATE;
 
        gensec_ntlmssp_state->allow_lm_key = (lp_lanman_auth() 
-                                         && lp_parm_bool(-1, "ntlmssp_server", "allow_lm_key", False));
+                                         && lp_parm_bool(NULL, "ntlmssp_server", "allow_lm_key", false));
 
        gensec_ntlmssp_state->server_multiple_authentications = False;
        
@@ -762,23 +762,23 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
        gensec_ntlmssp_state->nt_resp = data_blob(NULL, 0);
        gensec_ntlmssp_state->encrypted_session_key = data_blob(NULL, 0);
 
-       if (lp_parm_bool(-1, "ntlmssp_server", "128bit", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_server", "128bit", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_128;               
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_server", "56bit", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_server", "56bit", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_56;                
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_server", "keyexchange", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_server", "keyexchange", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_KEY_EXCH;          
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_server", "alwayssign", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_server", "alwayssign", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN;               
        }
 
-       if (lp_parm_bool(-1, "ntlmssp_server", "ntlm2", True)) {
+       if (lp_parm_bool(NULL, "ntlmssp_server", "ntlm2", true)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_NTLM2;             
        }
 
index 2663184c837623c4b8fdbd0d7efcac7b4bb20d02..8ecb0a628c86f2363fd4130fed84e9ef2390121f 100644 (file)
@@ -103,7 +103,7 @@ static struct argdef args[] =
  */
 };
 
-struct argdef * find_named_arg(const char * arg)
+static struct argdef * find_named_arg(const char * arg)
 {
        int i;
 
@@ -419,7 +419,7 @@ static int copy_files(void)
         * could accumulate a remainder if ibs and obs don't match.
         */
        iomax = 2 * MAX(ibs, obs);
-       if ((iobuf = malloc(iomax)) == NULL) {
+       if ((iobuf = malloc_array_p(uint8_t, iomax)) == NULL) {
                fprintf(stderr,
                        "%s: failed to allocate IO buffer of %llu bytes\n",
                        PROGNAME, (unsigned long long)iomax);
index 693de9fef38fb76f0325f90a6393060b28e3a381..ad35a5effead02469f3b4ffb5af55e5fdd415565 100644 (file)
@@ -81,7 +81,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops,
                                          TALLOC_CTX *mem_ctx, const char *dbname, 
                                          int flags)
 {
-       const char *dir = lp_parm_string(-1, "ctdb", "shared data");
+       const char *dir = lp_parm_string(NULL, "ctdb", "shared data");
        char *path;
        struct tdb_wrap *w;
        if (dir == NULL) {
@@ -201,7 +201,7 @@ void cluster_ctdb_init(struct event_context *ev, const char *model)
        struct cluster_state *state;
        int ret;
 
-       if (!lp_parm_bool(-1, "ctdb", "enable", False)) {
+       if (!lp_parm_bool(NULL, "ctdb", "enable", false)) {
                return;
        }
 
index 738d8a1f0f7611e7408b0f28b6e721178b2078f2..a01478f784a52f24bf729899c6f04eb2fee0ae32 100644 (file)
@@ -97,7 +97,7 @@ static struct odb_context *odb_ctdb_init(TALLOC_CTX *mem_ctx,
        odb->ntvfs_ctx = ntvfs_ctx;
 
        /* leave oplocks disabled by default until the code is working */
-       odb->oplocks = lp_parm_bool(-1, "opendb", "oplocks", False);
+       odb->oplocks = lp_parm_bool(NULL, "opendb", "oplocks", false);
 
        return odb;
 }
index e4e2aedcf734ec31e55bf2f0e4095643dfabff00..2896050ddc70c6f62c84e49a7c9527472ad19f10 100644 (file)
@@ -165,8 +165,8 @@ static void dreplsrv_task_init(struct task_server *task)
                return;
        }
 
-       periodic_startup_interval       = lp_parm_int(-1, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */
-       service->periodic.interval      = lp_parm_int(-1, "dreplsrv", "periodic_interval", 300); /* in seconds */
+       periodic_startup_interval       = lp_parm_int(NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */
+       service->periodic.interval      = lp_parm_int(NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */
 
        status = dreplsrv_periodic_schedule(service, periodic_startup_interval);
        if (!W_ERROR_IS_OK(status)) {
index aa5d221fd8dd392ea5658610f32c35abf010e539..3754be2e96001e77bbf4ef2e55dabebf9d0f6549 100644 (file)
@@ -348,7 +348,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
 
        struct smb_krb5_context *smb_krb5_context;
        ret = smb_krb5_init_context(mem_ctx, 
-                                   ldb_get_opaque(sam_ctx, "EventContext"), 
+                                   (struct event_context *)ldb_get_opaque(sam_ctx, "EventContext"), 
                                    &smb_krb5_context);
                                
        if (ret) {
index 22d04a5519a4a49a242b66d22f2eaaac24c155f6..5f4317a646c34a159adb5d13023289687da4497a 100644 (file)
@@ -341,7 +341,7 @@ static int setup_primary_kerberos(struct setup_password_fields_io *io,
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       if (lp_parm_bool(-1, "password_hash", "create_aes_key", false)) {
+       if (lp_parm_bool(NULL, "password_hash", "create_aes_key", false)) {
        /*
         * TODO:
         *
index 93f45b8cf7fb3c58698e3ec33dc5b0f531d040b3..ed11354498f710d6791f069983ec8abffef5a529 100644 (file)
@@ -481,7 +481,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
                entry_ex->entry.flags.ok_as_delegate = 1;
        }
 
-       if (lp_parm_bool(-1, "kdc", "require spn for service", True)) {
+       if (lp_parm_bool(NULL, "kdc", "require spn for service", true)) {
                if (!is_computer && !ldb_msg_find_attr_as_string(msg, "servicePrincipalName", NULL)) {
                        entry_ex->entry.flags.server = 0;
                }
index 0dfc2e0ed2d6347c2ac3e05316724783a8224bce..67d0a4e7601558aa180cd5fce9c79018c5fb806e 100644 (file)
@@ -154,7 +154,7 @@ EjsId ejsOpenEngine(EjsHandle primaryHandle, EjsHandle altHandle)
        MprVar  *np;
        Ejs             *ep;
 
-       ep = mprMalloc(sizeof(Ejs));
+       ep = (Ejs *)mprMalloc(sizeof(Ejs));
        if (ep == 0) {
                return (EjsId) -1;
        }
index 8510f70d96952aaeb9e3f0cb3ca36a79997fb702..1c571f896182da9469482ceb8dd3454736e14302 100644 (file)
@@ -75,7 +75,7 @@ static struct charset_functions *charsets = NULL;
 
 bool charset_register_backend(const void *_funcs) 
 {
-       struct charset_functions *funcs = memdup(_funcs,sizeof(struct charset_functions));
+       struct charset_functions *funcs = (struct charset_functions *)memdup(_funcs,sizeof(struct charset_functions));
        struct charset_functions *c;
 
        /* Check whether we already have this charset... */
@@ -199,7 +199,7 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode)
        }
 
 #ifdef HAVE_NATIVE_ICONV
-       if ((!from || !to) && !lp_parm_bool(-1, "iconv", "native", true)) {
+       if ((!from || !to) && !lp_parm_bool(NULL, "iconv", "native", true)) {
                goto failed;
        }
        if (!from) {
index f91006b46c0bf1bdb0b9dd3081b50e0500825ff9..3a8d0482216b33c2edae442386a709c55b9378b6 100644 (file)
@@ -161,7 +161,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
        }
 
        /* allow admins to force non-sync ldb for all databases */
-       if (lp_parm_bool(-1, "ldb", "nosync", False)) {
+       if (lp_parm_bool(NULL, "ldb", "nosync", false)) {
                flags |= LDB_FLG_NOSYNC;
        }
 
index 02e82c77a70ba3403340575930a1f325664e6fd5..057a6f0057204790b348066bde7ae1372928938c 100644 (file)
@@ -30,8 +30,8 @@
  */
 struct db_context *db_tmp_open(TALLOC_CTX *mem_ctx, const char *name, int tdb_flags)
 {
-       if (lp_parm_bool(-1, "ctdb", "enable", False) &&
-           lp_parm_bool(-1, "ctdb", name, True)) {
+       if (lp_parm_bool(NULL, "ctdb", "enable", false) &&
+           lp_parm_bool(NULL, "ctdb", name, true)) {
                    return db_tmp_open_ctdb(mem_ctx, name, tdb_flags);
        }
 
index 77225b9ddf34af4643c37111e74cd4b295d332a8..da3cc3bfe02dc2a03af37959d0488c75610a5b3b 100644 (file)
@@ -185,7 +185,7 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char
 
 #if _SAMBA_BUILD_
        if (name == NULL) {
-               name = lp_parm_string(-1, "event", "backend");
+               name = lp_parm_string(NULL, "event", "backend");
        }
 #endif
        if (name == NULL) {
index ec72d01121058a2d8f9c71bdc6326db4a39b3b86..64df4cfecb86443c1f7d65d31c14058687bcd487 100644 (file)
@@ -677,7 +677,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_
                }
        }
 
-       target_str = lp_parm_string(-1, "convert", "target");
+       target_str = lp_parm_string(NULL, "convert", "target");
 
        if (!target_str || strcasecmp(target_str, "openldap") == 0) {
                target = TARGET_OPENLDAP;
index a04bc1168e25ba9ac88126f44570554cc11a539e..a71e31474c61a49d01293b5f7a53e65df802c946 100644 (file)
@@ -31,9 +31,9 @@ NTSTATUS torture_temp_dir(struct torture_context *tctx, const char *prefix,
                                                                   const char **tempdir);
 
 static bool test_del_nonexistant_key(struct torture_context *tctx,
-                                                                        const void *test_data)
+                                    const void *test_data)
 {
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        WERROR error = hive_key_del(root, "bla");
        torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, 
                                                          "invalid return code");
@@ -45,7 +45,7 @@ static bool test_keyinfo_root(struct torture_context *tctx,
                                                 const void *test_data)
 {
        uint32_t num_subkeys, num_values;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        WERROR error;
 
        /* This is a new backend. There should be no subkeys and no 
@@ -67,7 +67,7 @@ static bool test_keyinfo_nums(struct torture_context *tctx,
                                                 const void *test_data)
 {
        uint32_t num_subkeys, num_values;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        WERROR error;
        struct hive_key *subkey;
        uint32_t data = 42;
@@ -100,7 +100,7 @@ static bool test_add_subkey(struct torture_context *tctx,
 {
        WERROR error;
        struct hive_key *subkey;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
 
        error = hive_key_add_name(mem_ctx, root, "Nested Key", NULL, 
@@ -114,9 +114,9 @@ static bool test_add_subkey(struct torture_context *tctx,
 }
 
 static bool test_flush_key(struct torture_context *tctx,
-                                         const void *test_data)
+                          const void *test_data)
 {
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
 
        torture_assert_werr_ok(tctx, hive_key_flush(root), "flush key");
 
@@ -127,7 +127,7 @@ static bool test_del_key(struct torture_context *tctx, const void *test_data)
 {
        WERROR error;
        struct hive_key *subkey;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
 
        error = hive_key_add_name(mem_ctx, root, "Nested Key", NULL, 
@@ -148,7 +148,7 @@ static bool test_set_value(struct torture_context *tctx,
 {
        WERROR error;
        struct hive_key *subkey;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
        uint32_t data = 42;
 
@@ -167,7 +167,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
 {
        WERROR error;
        struct hive_key *subkey;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
        uint32_t data = 42;
        uint32_t type;
@@ -200,7 +200,7 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
 {
        WERROR error;
        struct hive_key *subkey;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
        uint32_t data = 42;
        uint32_t type;
@@ -231,7 +231,7 @@ static bool test_list_values(struct torture_context *tctx,
 {
        WERROR error;
        struct hive_key *subkey;
-       const struct hive_key *root = test_data;
+       const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
        uint32_t data = 42;
        uint32_t type;
index 9ac61b1bc0c5746ee7d1d4d75fa43cb94298601c..9809a6d4c8dd8e6b766b6009205555239ce8063c 100644 (file)
@@ -37,7 +37,8 @@ NTSTATUS torture_temp_dir(struct torture_context *tctx, const char *prefix,
 static bool test_get_predefined(struct torture_context *tctx,
                                                                const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root;
        WERROR error;
 
@@ -66,7 +67,8 @@ static bool test_get_predefined_unknown(struct torture_context *tctx,
 static bool test_predef_key_by_name(struct torture_context *tctx,
                                                                const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root;
        WERROR error;
 
@@ -84,7 +86,8 @@ static bool test_predef_key_by_name(struct torture_context *tctx,
 static bool test_predef_key_by_name_invalid(struct torture_context *tctx,
                                                                const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root;
        WERROR error;
 
@@ -100,7 +103,8 @@ static bool test_predef_key_by_name_invalid(struct torture_context *tctx,
 static bool test_create_subkey(struct torture_context *tctx,
                                                      const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *newkey;
        WERROR error;
 
@@ -121,7 +125,8 @@ static bool test_create_subkey(struct torture_context *tctx,
 static bool test_create_nested_subkey(struct torture_context *tctx,
                                                      const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *newkey1, *newkey2;
        WERROR error;
 
@@ -148,7 +153,8 @@ static bool test_create_nested_subkey(struct torture_context *tctx,
 static bool test_key_add_abs_top(struct torture_context *tctx,
                                                         const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root;
        WERROR error;
 
@@ -165,7 +171,8 @@ static bool test_key_add_abs(struct torture_context *tctx,
                                                         const void *_data)
 {
        WERROR error;
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *result1, *result2;
 
        error = reg_key_add_abs(tctx, rctx,  "HKEY_CLASSES_ROOT\\bloe", 0, NULL, &result1);
@@ -190,7 +197,8 @@ static bool test_key_add_abs(struct torture_context *tctx,
 
 static bool test_del_key(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *newkey;
        WERROR error;
 
@@ -238,7 +246,8 @@ static bool create_test_key(struct torture_context *tctx,
 
 static bool test_flush_key(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *subkey;
        WERROR error;
 
@@ -256,7 +265,8 @@ static bool test_flush_key(struct torture_context *tctx, const void *_data)
 
 static bool test_query_key(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *subkey;
        WERROR error;
        NTTIME last_changed_time;
@@ -280,7 +290,8 @@ static bool test_query_key(struct torture_context *tctx, const void *_data)
 
 static bool test_query_key_nums(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *root, *subkey1, *subkey2;
        WERROR error;
        uint32_t num_subkeys, num_values;
@@ -313,7 +324,8 @@ static bool test_query_key_nums(struct torture_context *tctx, const void *_data)
  */
 static bool test_list_subkeys(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        NTTIME last_mod_time;
@@ -351,7 +363,8 @@ static bool test_list_subkeys(struct torture_context *tctx, const void *_data)
  */
 static bool test_set_value(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        uint32_t data = 42;
@@ -371,7 +384,8 @@ static bool test_set_value(struct torture_context *tctx, const void *_data)
  */
 static bool test_security(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        struct security_descriptor *osd, *nsd;
@@ -404,7 +418,8 @@ static bool test_security(struct torture_context *tctx, const void *_data)
  */
 static bool test_get_value(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        DATA_BLOB data;
@@ -439,7 +454,8 @@ static bool test_get_value(struct torture_context *tctx, const void *_data)
  */
 static bool test_del_value(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        DATA_BLOB data;
@@ -473,7 +489,8 @@ static bool test_del_value(struct torture_context *tctx, const void *_data)
  */
 static bool test_list_values(struct torture_context *tctx, const void *_data)
 {
-       const struct registry_context *rctx = _data;
+       const struct registry_context *rctx = 
+               (const struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        DATA_BLOB data;
index 184c89f3edfb25098a6ce5a7c2c0173d9c4e1eb6..55a1b6394b289a890bbf57a7cefab155b90118da 100644 (file)
@@ -70,7 +70,7 @@ _PUBLIC_ NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socke
 
        if (!(flags & SOCKET_FLAG_BLOCK) &&
            type == SOCKET_TYPE_STREAM &&
-           lp_parm_bool(-1, "socket", "testnonblock", False)) {
+           lp_parm_bool(NULL, "socket", "testnonblock", false)) {
                (*new_sock)->flags |= SOCKET_FLAG_TESTNONBLOCK;
        }
 
index ad65df0e6c001f9bf69cf9746b898d24409a7e00..240ae056c13a70b1b908c38e101f999dbe548293 100644 (file)
@@ -153,5 +153,5 @@ failed:
 }
 
 #else
- void tls_cert_dummy(void) {}
+void tls_cert_dummy(void) {}
 #endif
index 41accd4bd2aa9e761fce121c18acc71a5b316675..437d9d741a892ed6009d252424b7e8d99a2ff6d4 100644 (file)
@@ -35,7 +35,7 @@ static const char *test_lists_shell_strings[] = {
 static bool test_lists_shell(struct torture_context *tctx,
                                                         const void *test_data)
 {
-       const char *data = test_data;
+       const char *data = (const char *)test_data;
        const char **ret1, **ret2, *tmp;
        bool match = true;
        TALLOC_CTX *mem_ctx = tctx;
index b44b50efd8c368de914ec10fdb2e55a1684fb366..453f0afcff82fb6d740b01d12beba59b9337ca23 100644 (file)
@@ -244,7 +244,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
                req->received_wack = True;
                /* although there can be a timeout in the packet, w2k3 screws it up,
                   so better to set it ourselves */                
-               req->timeout = lp_parm_int(-1, "nbt", "wack_timeout", 30);
+               req->timeout = lp_parm_int(NULL, "nbt", "wack_timeout", 30);
                req->te = event_add_timed(req->nbtsock->event_ctx, req, 
                                          timeval_current_ofs(req->timeout, 0),
                                          nbt_name_socket_timeout, req);
index faa2962d5adcd94e74499eeb056c16525d61fff0..be4d01b79a4b5a1ff2f4a548011640486d9beeeb 100644 (file)
@@ -155,7 +155,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
 
                state->io_queries[i].in.broadcast   = broadcast;
                state->io_queries[i].in.wins_lookup = wins_lookup;
-               state->io_queries[i].in.timeout     = lp_parm_int(-1, "nbt", "timeout", 1);
+               state->io_queries[i].in.timeout     = lp_parm_int(NULL, "nbt", "timeout", 1);
                state->io_queries[i].in.retries     = 2;
 
                state->queries[i] = nbt_name_query_send(state->nbtsock, &state->io_queries[i]);
index cca4f861de97ba499c6f819ef57330b2d9ededf0..2d2c8252a1fb6cb43e272329394cddf1e3c63c89 100644 (file)
@@ -582,7 +582,7 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me
        size = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, 
                                     blob.data, blob.length, &vstr);
        data_blob_free(&blob);
-       (*str) = vstr;
+       (*str) = (char *)vstr;
        if (size == -1) {
                return NT_STATUS_ILLEGAL_CHARACTER;
        }
index 47a250a5f2bb18fa90feddf3107cc6e3e61c7a8d..13d20202e12d935b3bdf98d4ec620aa7a7fd841d 100644 (file)
@@ -1511,7 +1511,7 @@ static void becomeDC_drsuapi_connect_send(struct libnet_BecomeDC_state *s,
        drsuapi->s = s;
 
        if (!drsuapi->binding) {
-               if (lp_parm_bool(-1, "become_dc", "print", False)) {
+               if (lp_parm_bool(NULL, "become_dc", "print", false)) {
                        binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[krb5,print,seal]", s->source_dsa.dns_name);
                        if (composite_nomem(binding_str, c)) return;
                } else {
index fc671a9b486925332c287a7830619b73b97f10ec..bde5a29cb951a94b390881311fcc68689f7f622f 100644 (file)
@@ -110,7 +110,7 @@ static NTSTATUS libnet_samdump_fn(TALLOC_CTX *mem_ctx,
                                  char **error_string)
 {
        NTSTATUS nt_status = NT_STATUS_OK;
-       struct samdump_state *samdump_state = private;
+       struct samdump_state *samdump_state = (struct samdump_state *)private;
 
        *error_string = NULL;
        switch (delta->delta_type) {
@@ -163,7 +163,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
 
        r2.out.error_string            = NULL;
        r2.in.binding_string           = r->in.binding_string;
-       r2.in.rid_crypt                = lp_parm_bool(-1, "vampire", "rid decrypt", True);
+       r2.in.rid_crypt                = lp_parm_bool(NULL, "vampire", "rid decrypt", true);
        r2.in.init_fn                  = NULL;
        r2.in.delta_fn                 = libnet_samdump_fn;
        r2.in.fn_ctx                   = samdump_state;
index 6b3b44109b3ae2ca9c9c3f7bee4f9b2460187b99..1d8cfec649682d6b0db912edcc64495dcaea5e69 100644 (file)
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "lib/compression/mszip.h"
 #include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_compression.h"
 
 static NTSTATUS ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpull,
                                                 struct ndr_push *ndrpush,
index f53d355daf54821598fdc4fa27e707338ecf2b6e..747b41076cfe1c878bf7aa8062f3abaffb2c49e7 100644 (file)
@@ -327,7 +327,7 @@ void nbtd_wack_reply(struct nbt_name_socket *nbtsock,
        packet->answers[0].rr_class          = NBT_QCLASS_IP;
        packet->answers[0].ttl               = ttl;
        packet->answers[0].rdata.data.length = 2;
-       packet->answers[0].rdata.data.data   = talloc_size(packet, 2);
+       packet->answers[0].rdata.data.data   = talloc_array(packet, uint8_t, 2);
        if (packet->answers[0].rdata.data.data == NULL) goto failed;
        RSSVAL(packet->answers[0].rdata.data.data, 0, request_packet->operation);
 
index 3b81d65bd2f990d8641fe6c4152ef9088e8dfcd8..d22903d5199c10cc0c29fb3fa9ed94aaf3cb1f7f 100644 (file)
@@ -118,7 +118,7 @@ static void name_refresh_handler(struct event_context *ev, struct timed_event *t
 static void nbtd_start_refresh_timer(struct nbtd_iface_name *iname)
 {
        uint32_t refresh_time;
-       uint32_t max_refresh_time = lp_parm_int(-1, "nbtd", "max_refresh_time", 7200);
+       uint32_t max_refresh_time = lp_parm_int(NULL, "nbtd", "max_refresh_time", 7200);
 
        refresh_time = MIN(max_refresh_time, iname->ttl/2);
        
@@ -188,7 +188,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface,
                iname->name.scope = NULL;
        }
        iname->nb_flags          = nb_flags;
-       iname->ttl               = lp_parm_int(-1, "nbtd", "bcast_ttl", 300000);
+       iname->ttl               = lp_parm_int(NULL, "nbtd", "bcast_ttl", 300000);
        iname->registration_time = timeval_zero();
        iname->wins_server       = NULL;
 
index 1fa073dc0d92aa4a912b551dc41d99615a2b6bde..2e5889fb1e6dfd280671f2424265f4895e660cc5 100644 (file)
@@ -87,7 +87,7 @@ static int wins_ldb_init(struct ldb_module *ctx)
 
        ctx->private_data = NULL;
 
-       owner = lp_parm_string(-1, "winsdb", "local_owner");
+       owner = lp_parm_string(NULL, "winsdb", "local_owner");
        if (!owner) {
                owner = iface_n_ip(0);
                if (!owner) {
index 279462289d241df382fc320a0ee4c87cd8ca1303..e18885c327ac6d653c9d06932f7df2da77dc8bdd 100644 (file)
@@ -58,7 +58,7 @@ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_even
 static void nbtd_wins_start_refresh_timer(struct nbtd_iface_name *iname)
 {
        uint32_t refresh_time;
-       uint32_t max_refresh_time = lp_parm_int(-1, "nbtd", "max_refresh_time", 7200);
+       uint32_t max_refresh_time = lp_parm_int(NULL, "nbtd", "max_refresh_time", 7200);
 
        refresh_time = MIN(max_refresh_time, iname->ttl/2);
        
@@ -179,7 +179,7 @@ static void nbtd_wins_register_handler(struct composite_context *c)
        if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
                /* none of the WINS servers responded - try again 
                   periodically */
-               int wins_retry_time = lp_parm_int(-1, "nbtd", "wins_retry", 300);
+               int wins_retry_time = lp_parm_int(NULL, "nbtd", "wins_retry", 300);
                event_add_timed(iname->iface->nbtsrv->task->event_ctx, 
                                iname,
                                timeval_current_ofs(wins_retry_time, 0),
index cfaee05020ddfafc96c6cce54d6e1435e0534860..6b26ba2d634764ba1310274434f45c8b35d81222 100644 (file)
@@ -988,7 +988,7 @@ static BOOL winsdb_check_or_add_module_list(struct winsdb_handle *h)
        talloc_free(h->ldb);
        h->ldb = NULL;
 
-       if (lp_parm_bool(-1,"winsdb", "nosync", False)) {
+       if (lp_parm_bool(NULL,"winsdb", "nosync", false)) {
                flags |= LDB_FLG_NOSYNC;
        }
 
@@ -1021,7 +1021,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_cal
        h = talloc(mem_ctx, struct winsdb_handle);
        if (!h) return NULL;
 
-       if (lp_parm_bool(-1,"winsdb", "nosync", False)) {
+       if (lp_parm_bool(NULL,"winsdb", "nosync", false)) {
                flags |= LDB_FLG_NOSYNC;
        }
 
@@ -1031,7 +1031,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_cal
 
        h->caller = caller;
 
-       owner = lp_parm_string(-1, "winsdb", "local_owner");
+       owner = lp_parm_string(NULL, "winsdb", "local_owner");
        if (!owner) {
                owner = iface_n_ip(0);
        }
index 47d25403864e88dc4287bf25cdd21b096c3b2ff7..fd0188cbf0cd33b44201cc72b1dc71fdb923790e 100644 (file)
@@ -615,7 +615,7 @@ static void nbtd_wins_randomize1Clist(const char **addresses, struct socket_addr
        ldb_qsort(addresses, num_addrs , sizeof(addresses[0]),
                  src, (ldb_qsort_cmp_fn_t)nbtd_wins_randomize1Clist_sort);
 
-       mask = lp_parm_string(-1, "nbtd", "wins_randomize1Clist_mask");
+       mask = lp_parm_string(NULL, "nbtd", "wins_randomize1Clist_mask");
        if (!mask) {
                mask = "255.255.255.0";
        }
@@ -691,7 +691,8 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock,
         * Typ: Daten REG_DWORD
         * Value: 0 = deactivated, 1 = activated
         */
-       if (name->type == NBT_NAME_LOGON && lp_parm_bool(-1, "nbtd", "wins_prepend1Bto1Cqueries", True)) {
+       if (name->type == NBT_NAME_LOGON && 
+           lp_parm_bool(NULL, "nbtd", "wins_prepend1Bto1Cqueries", true)) {
                struct nbt_name name_1b;
 
                name_1b = *name;
@@ -786,7 +787,8 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock,
         * Typ: Daten REG_DWORD
         * Value: 0 = deactivated, 1 = activated
         */
-       if (name->type == NBT_NAME_LOGON && lp_parm_bool(-1, "nbtd", "wins_randomize1Clist", False)) {
+       if (name->type == NBT_NAME_LOGON && 
+           lp_parm_bool(NULL, "nbtd", "wins_randomize1Clist", false)) {
                nbtd_wins_randomize1Clist(addresses, src);
        }
 
@@ -965,9 +967,9 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
 
        nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl();
        nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl();
-       tmp = lp_parm_int(-1,"wreplsrv","tombstone_interval", 6*24*60*60);
+       tmp = lp_parm_int(NULL, "wreplsrv", "tombstone_interval", 6*24*60*60);
        nbtsrv->winssrv->config.tombstone_interval = tmp;
-       tmp = lp_parm_int(-1,"wreplsrv","tombstone_timeout", 1*24*60*60);
+       tmp = lp_parm_int(NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60);
        nbtsrv->winssrv->config.tombstone_timeout = tmp;
 
        nbtsrv->winssrv->wins_db     = winsdb_connect(nbtsrv->winssrv, WINSDB_HANDLE_CALLER_NBTD);
index 63c6abd3deef41be8211ad6152e9d668d4891885..1b1573bc9610a2f878fe3e6bc77045b8f6e86c0c 100644 (file)
@@ -62,7 +62,7 @@ _PUBLIC_ struct odb_context *odb_init(TALLOC_CTX *mem_ctx,
                                      struct ntvfs_context *ntvfs_ctx)
 {
        if (ops == NULL) {
-               if (lp_parm_bool(-1, "ctdb", "opendb", False)) {
+               if (lp_parm_bool(NULL, "ctdb", "opendb", false)) {
                        odb_ctdb_init_ops();
                } else {
                        odb_tdb_init_ops();
index 0a79b791250f6a5982e3f861fa5639150d14cae9..7c6e9f48b3dca6c666f2c4c3ab362b2817297955 100644 (file)
@@ -88,7 +88,7 @@ static struct odb_context *odb_tdb_init(TALLOC_CTX *mem_ctx,
        odb->ntvfs_ctx = ntvfs_ctx;
 
        /* leave oplocks disabled by default until the code is working */
-       odb->oplocks = lp_parm_bool(-1, "opendb", "oplocks", False);
+       odb->oplocks = lp_parm_bool(NULL, "opendb", "oplocks", false);
 
        return odb;
 }
index 75e474a94e7cf102a4dfb101a3178cc01539e271..9e02125dc7ab7bed5fba9ef51f3f3ee9e8c2c0b9 100644 (file)
@@ -614,7 +614,7 @@ NTSTATUS pvfs_mangle_init(struct pvfs_state *pvfs)
        }
 
        /* by default have a max of 512 entries in the cache. */
-       ctx->cache_size = lp_parm_int(-1, "mangle", "cachesize", 512);
+       ctx->cache_size = lp_parm_int(NULL, "mangle", "cachesize", 512);
 
        ctx->prefix_cache = talloc_array(ctx, char *, ctx->cache_size);
        if (ctx->prefix_cache == NULL) {
@@ -628,7 +628,7 @@ NTSTATUS pvfs_mangle_init(struct pvfs_state *pvfs)
        memset(ctx->prefix_cache, 0, sizeof(char *) * ctx->cache_size);
        memset(ctx->prefix_cache_hashes, 0, sizeof(uint32_t) * ctx->cache_size);
 
-       ctx->mangle_prefix = lp_parm_int(-1, "mangle", "prefix", -1);
+       ctx->mangle_prefix = lp_parm_int(NULL, "mangle", "prefix", -1);
        if (ctx->mangle_prefix < 0 || ctx->mangle_prefix > 6) {
                ctx->mangle_prefix = DEFAULT_MANGLE_PREFIX;
        }
index 6fab1018ca5b253573b8215a06970ff8e2bd9fa3..b73ee2c5261fc03ba763af2ac385c6ca79e0ba18 100644 (file)
@@ -245,7 +245,7 @@ static NTSTATUS inotify_setup(struct sys_notify_context *ctx)
 {
        struct inotify_private *in;
 
-       if (!lp_parm_bool(-1, "notify", "inotify", True)) {
+       if (!lp_parm_bool(NULL, "notify", "inotify", true)) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
 
index c7c7656863072b81e4911a84596d660fe0a7f72d..61b1aafbf499aa56771aeb1d821068476498a1fa 100644 (file)
@@ -819,19 +819,15 @@ static const char *lp_string(const char *s)
  int fn_name(void) {return(*(int *)(ptr));}
 
 #define FN_LOCAL_STRING(fn_name,val) \
- const char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && loadparm.ServicePtrs[(i)]->val) ? loadparm.ServicePtrs[(i)]->val : sDefault.val));}
+ const char *fn_name(struct service *service) {return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault.val)));}
 #define FN_LOCAL_CONST_STRING(fn_name,val) \
- const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && loadparm.ServicePtrs[(i)]->val) ? loadparm.ServicePtrs[(i)]->val : sDefault.val);}
+ const char *fn_name(struct service *service) {return (const char *)(service != NULL && service->val != NULL) ? service->val : sDefault.val;}
 #define FN_LOCAL_LIST(fn_name,val) \
- const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? loadparm.ServicePtrs[(i)]->val : sDefault.val);}
+ const char **fn_name(struct service *service) {return(const char **)(service != NULL && service->val != NULL? service->val : sDefault.val);}
 #define FN_LOCAL_BOOL(fn_name,val) \
- bool fn_name(int i) {return(LP_SNUM_OK(i)? loadparm.ServicePtrs[(i)]->val : sDefault.val);}
-#if 0 /* unused */
-#define FN_LOCAL_CHAR(fn_name,val) \
- char fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
-#endif
+ bool fn_name(struct service *service) {return((service != NULL)? service->val : sDefault.val);}
 #define FN_LOCAL_INTEGER(fn_name,val) \
- int fn_name(int i) {return(LP_SNUM_OK(i)? loadparm.ServicePtrs[(i)]->val : sDefault.val);}
+ int fn_name(struct service *service) {return((service != NULL)? service->val : sDefault.val);}
 
 _PUBLIC_ FN_GLOBAL_INTEGER(lp_server_role, &loadparm.Globals.server_role)
 _PUBLIC_ FN_GLOBAL_LIST(lp_smb_ports, &loadparm.Globals.smb_ports)
@@ -968,16 +964,12 @@ static void init_copymap(struct service * pservice);
 /* This is a helper function for parametrical options support. */
 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
 /* Actual parametrical functions are quite simple */
-const char *lp_get_parametric(int lookup_service, const char *type, const char *option)
+const char *lp_get_parametric(struct service *service, const char *type, const char *option)
 {
        char *vfskey;
         struct param_opt *data;
        
-       if (lookup_service >= 0 && !LP_SNUM_OK(lookup_service))
-               return NULL;
-       
-       data = (lookup_service < 0) ? 
-               loadparm.Globals.param_opt : loadparm.ServicePtrs[lookup_service]->param_opt;
+       data = (service == NULL ?  loadparm.Globals.param_opt : service->param_opt);
     
        asprintf(&vfskey, "%s:%s", type, option);
        strlower(vfskey);
@@ -990,7 +982,7 @@ const char *lp_get_parametric(int lookup_service, const char *type, const char *
                data = data->next;
        }
 
-       if (lookup_service >= 0) {
+       if (service != NULL) {
                /* Try to fetch the same option but from globals */
                /* but only if we are not already working with Globals */
                for (data = loadparm.Globals.param_opt; data; 
@@ -1075,9 +1067,10 @@ static bool lp_bool(const char *s)
 /* Parametric option has following syntax: 'Type: option = value' */
 /* Returned value is allocated in 'lp_talloc' context */
 
-const char *lp_parm_string(int lookup_service, const char *type, const char *option)
+const char *lp_parm_string(struct service *service, const char *type, 
+                          const char *option)
 {
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
 
        if (value)
                return lp_string(value);
@@ -1089,10 +1082,10 @@ const char *lp_parm_string(int lookup_service, const char *type, const char *opt
 /* Parametric option has following syntax: 'Type: option = value' */
 /* Returned value is allocated in 'lp_talloc' context */
 
-const char **lp_parm_string_list(int lookup_service, const char *type, const char *option,
-                                const char *separator)
+const char **lp_parm_string_list(struct service *service, const char *type, 
+                                const char *option, const char *separator)
 {
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
        
        if (value)
                return str_list_make(talloc_autofree_context(), value, separator);
@@ -1103,9 +1096,10 @@ const char **lp_parm_string_list(int lookup_service, const char *type, const cha
 /* Return parametric option from a given service. Type is a part of option before ':' */
 /* Parametric option has following syntax: 'Type: option = value' */
 
-int lp_parm_int(int lookup_service, const char *type, const char *option, int default_v)
+int lp_parm_int(struct service *service, const char *type, const char *option, 
+               int default_v)
 {
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
        
        if (value)
                return lp_int(value);
@@ -1118,11 +1112,12 @@ int lp_parm_int(int lookup_service, const char *type, const char *option, int de
  * Parametric option has following syntax: 'Type: option = value'.
  */
 
-int lp_parm_bytes(int lookup_service, const char *type, const char *option, int default_v)
+int lp_parm_bytes(struct service *service, const char *type, 
+                 const char *option, int default_v)
 {
        uint64_t bval;
 
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
 
        if (value && conv_str_size(value, &bval)) {
                if (bval <= INT_MAX) {
@@ -1136,9 +1131,10 @@ int lp_parm_bytes(int lookup_service, const char *type, const char *option, int
 /* Return parametric option from a given service. Type is a part of option before ':' */
 /* Parametric option has following syntax: 'Type: option = value' */
 
-unsigned long lp_parm_ulong(int lookup_service, const char *type, const char *option, unsigned long default_v)
+unsigned long lp_parm_ulong(struct service *service, const char *type, 
+                           const char *option, unsigned long default_v)
 {
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
        
        if (value)
                return lp_ulong(value);
@@ -1147,9 +1143,10 @@ unsigned long lp_parm_ulong(int lookup_service, const char *type, const char *op
 }
 
 
-double lp_parm_double(int lookup_service, const char *type, const char *option, double default_v)
+double lp_parm_double(struct service *service, const char *type, 
+                     const char *option, double default_v)
 {
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
        
        if (value)
                return lp_double(value);
@@ -1160,10 +1157,10 @@ double lp_parm_double(int lookup_service, const char *type, const char *option,
 /* Return parametric option from a given service. Type is a part of option before ':' */
 /* Parametric option has following syntax: 'Type: option = value' */
 
-bool lp_parm_bool(int lookup_service, const char *type, const char *option
-                 bool default_v)
+bool lp_parm_bool(struct service *service, const char *type
+                 const char *option, bool default_v)
 {
-       const char *value = lp_get_parametric(lookup_service, type, option);
+       const char *value = lp_get_parametric(service, type, option);
        
        if (value)
                return lp_bool(value);
@@ -1261,22 +1258,22 @@ static struct service *add_a_service(const struct service *pservice, const char
  from service ifrom.
 ***************************************************************************/
 
-bool lp_add_home(const char *pszHomename, int iDefaultService, 
+bool lp_add_home(const char *pszHomename, struct service *default_service,
                 const char *user, const char *pszHomedir)
 {
        struct service *service;
        pstring newHomedir;
 
-       service = add_a_service(loadparm.ServicePtrs[iDefaultService], pszHomename);
+       service = add_a_service(default_service, pszHomename);
 
        if (service == NULL)
                return false;
 
-       if (!(*(loadparm.ServicePtrs[iDefaultService]->szPath))
-           || strequal(loadparm.ServicePtrs[iDefaultService]->szPath, lp_pathname(-1))) {
+       if (!(*(default_service->szPath))
+           || strequal(default_service->szPath, sDefault.szPath)) {
                pstrcpy(newHomedir, pszHomedir);
        } else {
-               pstrcpy(newHomedir, lp_pathname(iDefaultService));
+               pstrcpy(newHomedir, lp_pathname(default_service));
                string_sub(newHomedir,"%H", pszHomedir, sizeof(newHomedir)); 
        }
 
@@ -1285,8 +1282,8 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
        if (!(*(service->comment))) {
                service->comment = talloc_asprintf(service, "Home directory of %s", user);
        }
-       service->bAvailable = sDefault.bAvailable;
-       service->bBrowseable = sDefault.bBrowseable;
+       service->bAvailable = default_service->bAvailable;
+       service->bBrowseable = default_service->bBrowseable;
 
        DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", 
                  pszHomename, user, newHomedir));
@@ -1298,9 +1295,10 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
  Add a new service, based on an old one.
 ***************************************************************************/
 
-struct service *lp_add_service(const char *pszService, int iDefaultService)
+struct service *lp_add_service(const char *pszService, 
+                              struct service *default_service)
 {
-       return add_a_service(loadparm.ServicePtrs[iDefaultService], pszService);
+       return add_a_service(default_service, pszService);
 }
 
 /***************************************************************************
@@ -1338,12 +1336,11 @@ static bool lp_add_hidden(const char *name, const char *fstype)
  Add a new printer service, with defaults coming from service iFrom.
 ***************************************************************************/
 
-bool lp_add_printer(const char *pszPrintername, int iDefaultService)
+bool lp_add_printer(const char *pszPrintername, struct service *default_service)
 {
        const char *comment = "From Printcap";
        struct service *service;
-       service = add_a_service(loadparm.ServicePtrs[iDefaultService], 
-                             pszPrintername);
+       service = add_a_service(default_service, pszPrintername);
 
        if (service == NULL)
                return false;
@@ -1406,12 +1403,12 @@ struct parm_struct *lp_parm_struct(const char *name)
 /*
   return the parameter pointer for a parameter
 */
-void *lp_parm_ptr(int snum, struct parm_struct *parm)
+void *lp_parm_ptr(struct service *service, struct parm_struct *parm)
 {
-       if (snum == -1) {
+       if (service == NULL)
                return parm->ptr;
-       }
-       return ((char *)loadparm.ServicePtrs[snum]) + PTR_DIFF(parm->ptr, &sDefault);
+
+       return ((char *)service) + PTR_DIFF(parm->ptr, &sDefault);
 }
 
 /***************************************************************************
@@ -2516,15 +2513,6 @@ bool lp_load(void)
        return bRetval;
 }
 
-/***************************************************************************
- Reset the max number of services.
-***************************************************************************/
-
-void lp_resetnumservices(void)
-{
-       loadparm.iNumServices = 0;
-}
-
 /***************************************************************************
  Return the max number of services.
 ***************************************************************************/
@@ -2550,22 +2538,35 @@ void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
        dump_a_service(&sDefault, f);
 
        for (iService = 0; iService < maxtoprint; iService++)
-               lp_dump_one(f, show_defaults, iService);
+               lp_dump_one(f, show_defaults, loadparm.ServicePtrs[iService]);
 }
 
 /***************************************************************************
 Display the contents of one service in human-readable form.
 ***************************************************************************/
 
-void lp_dump_one(FILE *f, bool show_defaults, int snum)
+void lp_dump_one(FILE *f, bool show_defaults, struct service *service)
 {
-       if (VALID(snum)) {
-               if (loadparm.ServicePtrs[snum]->szService[0] == '\0')
+       if (service != NULL) {
+               if (service->szService[0] == '\0')
                        return;
-               dump_a_service(loadparm.ServicePtrs[snum], f);
+               dump_a_service(service, f);
        }
 }
 
+struct service *lp_servicebynum(int snum)
+{
+       return loadparm.ServicePtrs[snum];
+}
+
+struct service *lp_service(const char *service_name)
+{
+       int snum = lp_servicenumber(service_name);
+       if (snum < 0)
+               return NULL;
+       return loadparm.ServicePtrs[snum];
+}
+
 /***************************************************************************
 Return the number of the service with the given name, or -1 if it doesn't
 exist. Note that this is a DIFFERENT ANIMAL from the internal function
@@ -2619,11 +2620,11 @@ int lp_find_valid_service(const char *pszServiceName)
 /*******************************************************************
  A useful volume label function. 
 ********************************************************************/
-const char *volume_label(int snum)
+const char *volume_label(struct service *service)
 {
-       const char *ret = lp_volume(snum);
+       const char *ret = lp_volume(service);
        if (!*ret)
-               return lp_servicename(snum);
+               return lp_servicename(service);
        return ret;
 }
 
@@ -2646,11 +2647,11 @@ void lp_remove_service(int snum)
        loadparm.ServicePtrs[snum] = NULL;
 }
 
-const char *lp_printername(int snum)
+const char *lp_printername(struct service *service)
 {
-       const char *ret = _lp_printername(snum);
+       const char *ret = _lp_printername(service);
        if (ret == NULL || (ret != NULL && *ret == '\0'))
-               ret = lp_const_servicename(snum);
+               ret = lp_const_servicename(service);
 
        return ret;
 }
index 5f5da58388fb54b9745011ca90edca2a1a6572d7..9b21acf726d85f433300afb91c4a73320a2fcb09 100644 (file)
@@ -57,7 +57,7 @@ enum announce_as {/* Types of machine we can announce as. */
        ANNOUNCE_AS_NT_WORKSTATION=4
 };
 
-
+struct service;
 
 #include "param/proto.h"
 
index 15f52eb9f1c0e40a8047e54d71649733e8477d9b..0c39322345012e70db6e67ca5c4eeccf8db3bc5e 100644 (file)
@@ -23,8 +23,8 @@
 #include "param/share.h"
 #include "param/param.h"
 
-struct sclassic_snum {
-       int snum;
+struct service {
+       struct service *service;
 };
 
 static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct share_context **ctx)
@@ -43,7 +43,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops,
 
 static const char *sclassic_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
 {
-       struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum);
+       struct service *s = talloc_get_type(scfg->opaque, struct service);
        char *parm, *val;
        const char *ret;
 
@@ -56,7 +56,7 @@ static const char *sclassic_string_option(struct share_config *scfg, const char
                *val = '\0';
                val++;
 
-               ret = lp_parm_string(s->snum, parm, val);
+               ret = lp_parm_string(s, parm, val);
                if (!ret) {
                        ret = defval;
                }
@@ -69,25 +69,25 @@ static const char *sclassic_string_option(struct share_config *scfg, const char
        }
 
        if (strcmp(opt_name, SHARE_PATH) == 0) {
-               return lp_pathname(s->snum);
+               return lp_pathname(s);
        }
 
        if (strcmp(opt_name, SHARE_COMMENT) == 0) {
-               return lp_comment(s->snum);
+               return lp_comment(s);
        }
 
        if (strcmp(opt_name, SHARE_VOLUME) == 0) {
-               return volume_label(s->snum);
+               return volume_label(s);
        }
 
        if (strcmp(opt_name, SHARE_TYPE) == 0) {
-               if (lp_print_ok(s->snum)) {
+               if (lp_print_ok(s)) {
                        return "PRINTER";
                }
-               if (strcmp("NTFS", lp_fstype(s->snum)) == 0) {
+               if (strcmp("NTFS", lp_fstype(s)) == 0) {
                        return "DISK";
                }
-               return lp_fstype(s->snum);
+               return lp_fstype(s);
        }
 
        if (strcmp(opt_name, SHARE_PASSWORD) == 0) {
@@ -100,9 +100,9 @@ static const char *sclassic_string_option(struct share_config *scfg, const char
        return defval;
 }
 
-int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval)
+static int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval)
 {
-       struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum);
+       struct service *s = talloc_get_type(scfg->opaque, struct service);
        char *parm, *val;
        int ret;
 
@@ -115,7 +115,7 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def
                *val = '\0';
                val++;
 
-               ret = lp_parm_int(s->snum, parm, val, defval);
+               ret = lp_parm_int(s, parm, val, defval);
                if (!ret) {
                        ret = defval;
                }
@@ -124,27 +124,27 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def
        }
 
        if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) {
-               return lp_csc_policy(s->snum);
+               return lp_csc_policy(s);
        }
 
        if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) {
-               return lp_max_connections(s->snum);
+               return lp_max_connections(s);
        }
 
        if (strcmp(opt_name, SHARE_CREATE_MASK) == 0) {
-               return lp_create_mask(s->snum);
+               return lp_create_mask(s);
        }
 
        if (strcmp(opt_name, SHARE_DIR_MASK) == 0) {
-               return lp_dir_mask(s->snum);
+               return lp_dir_mask(s);
        }
 
        if (strcmp(opt_name, SHARE_FORCE_DIR_MODE) == 0) {
-               return lp_force_dir_mode(s->snum);
+               return lp_force_dir_mode(s);
        }
 
        if (strcmp(opt_name, SHARE_FORCE_CREATE_MODE) == 0) {
-               return lp_force_create_mode(s->snum);
+               return lp_force_create_mode(s);
        }
 
 
@@ -154,9 +154,10 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def
        return defval;
 }
 
-BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL defval)
+static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name, 
+                         bool defval)
 {
-       struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum);
+       struct service *s = talloc_get_type(scfg->opaque, struct service);
        char *parm, *val;
        BOOL ret;
 
@@ -169,49 +170,49 @@ BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL
                *val = '\0';
                val++;
 
-               ret = lp_parm_bool(s->snum, parm, val, defval);
+               ret = lp_parm_bool(s, parm, val, defval);
                talloc_free(parm);
                return ret;
        }
 
        if (strcmp(opt_name, SHARE_AVAILABLE) == 0) {
-               return lp_snum_ok(s->snum);
+               return s != NULL;
        }
 
        if (strcmp(opt_name, SHARE_BROWSEABLE) == 0) {
-               return lp_browseable(s->snum);
+               return lp_browseable(s);
        }
 
        if (strcmp(opt_name, SHARE_READONLY) == 0) {
-               return lp_readonly(s->snum);
+               return lp_readonly(s);
        }
 
        if (strcmp(opt_name, SHARE_MAP_SYSTEM) == 0) {
-               return lp_map_system(s->snum);
+               return lp_map_system(s);
        }
 
        if (strcmp(opt_name, SHARE_MAP_HIDDEN) == 0) {
-               return lp_map_hidden(s->snum);
+               return lp_map_hidden(s);
        }
 
        if (strcmp(opt_name, SHARE_MAP_ARCHIVE) == 0) {
-               return lp_map_archive(s->snum);
+               return lp_map_archive(s);
        }
 
        if (strcmp(opt_name, SHARE_STRICT_LOCKING) == 0) {
-               return lp_strict_locking(s->snum);
+               return lp_strict_locking(s);
        }
 
        if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) {
-               return lp_strict_sync(s->snum);
+               return lp_strict_sync(s);
        }
 
        if (strcmp(opt_name, SHARE_MSDFS_ROOT) == 0) {
-               return lp_msdfs_root(s->snum);
+               return lp_msdfs_root(s);
        }
 
        if (strcmp(opt_name, SHARE_CI_FILESYSTEM) == 0) {
-               return lp_ci_filesystem(s->snum);
+               return lp_ci_filesystem(s);
        }
 
        DEBUG(0,("request for unknown share bool option '%s'\n",
@@ -220,9 +221,9 @@ BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL
        return defval;
 }
 
-const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name)
+static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name)
 {
-       struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum);
+       struct service *s = talloc_get_type(scfg->opaque, struct service);
        char *parm, *val;
        const char **ret;
 
@@ -235,21 +236,21 @@ const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_confi
                *val = '\0';
                val++;
 
-               ret = lp_parm_string_list(s->snum, parm, val, ",;");
+               ret = lp_parm_string_list(s, parm, val, ",;");
                talloc_free(parm);
                return ret;
        }
 
        if (strcmp(opt_name, SHARE_HOSTS_ALLOW) == 0) {
-               return lp_hostsallow(s->snum);
+               return lp_hostsallow(s);
        }
 
        if (strcmp(opt_name, SHARE_HOSTS_DENY) == 0) {
-               return lp_hostsdeny(s->snum);
+               return lp_hostsdeny(s);
        }
 
        if (strcmp(opt_name, SHARE_NTVFS_HANDLER) == 0) {
-               return lp_ntvfs_handler(s->snum);
+               return lp_ntvfs_handler(s);
        }
 
        DEBUG(0,("request for unknown share list option '%s'\n",
@@ -258,10 +259,10 @@ const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_confi
        return NULL;
 }
 
-NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx,
-                                    struct share_context *ctx,
-                                    int *count,
-                                    const char ***names)
+static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx,
+                                 struct share_context *ctx,
+                                 int *count,
+                                 const char ***names)
 {
        int i;
        int num_services;
@@ -276,7 +277,7 @@ NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx,
        }
 
        for (i = 0; i < num_services; i++) {
-               n[i] = talloc_strdup(n, lp_servicename(i));
+               n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum(i)));
                if (!n[i]) {
                        DEBUG(0,("ERROR: Out of memory!\n"));
                        talloc_free(n);
@@ -290,24 +291,17 @@ NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
-NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx,
-                            struct share_context *ctx,
-                            const char *name,
-                            struct share_config **scfg)
+static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx,
+                                   struct share_context *ctx,
+                                   const char *name,
+                                   struct share_config **scfg)
 {
-       int i, snum;
        struct share_config *s;
-       struct sclassic_snum *scnum;
+       struct service *service;
 
-       snum = -1;
-       for (i = 0; i < lp_numservices(); i++) {
-               if (strcasecmp_m(name, lp_servicename(i)) == 0) {
-                       snum = i;
-                       break;
-               }
-       }
+       service = lp_service(name);
 
-       if (snum < 0) {
+       if (service == NULL) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
@@ -317,22 +311,14 @@ NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       s->name = talloc_strdup(s, lp_servicename(snum));
+       s->name = talloc_strdup(s, lp_servicename(service));
        if (!s->name) {
                DEBUG(0,("ERROR: Out of memory!\n"));
                talloc_free(s);
                return NT_STATUS_NO_MEMORY;
        }
 
-       scnum = talloc(s, struct sclassic_snum);
-       if (!scnum) {
-               DEBUG(0,("ERROR: Out of memory!\n"));
-               talloc_free(s);
-               return NT_STATUS_NO_MEMORY;
-       }
-       scnum->snum = snum;
-
-       s->opaque = (void *)scnum;
+       s->opaque = (void *)service;
        s->ctx = ctx;
        
        *scfg = s;
index 7ca13fcf9451a2ad611bf273d71d7ee0febb7f62..8848dcd1df04d4d97901aaf9358ecee0c7c94cbf 100644 (file)
@@ -36,7 +36,7 @@ _PUBLIC_ enum srvsvc_PlatformId dcesrv_common_get_platform_id(TALLOC_CTX *mem_ct
 {
        enum srvsvc_PlatformId id;
 
-       id = lp_parm_int(-1, "server_info", "platform_id", PLATFORM_ID_NT);
+       id = lp_parm_int(NULL, "server_info", "platform_id", PLATFORM_ID_NT);
 
        return id;
 }
@@ -66,19 +66,19 @@ const char *dcesrv_common_get_domain_name(TALLOC_CTX *mem_ctx, struct dcesrv_con
 /* This hardcoded value should go into a ldb database! */
 _PUBLIC_ uint32_t dcesrv_common_get_version_major(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return lp_parm_int(-1, "server_info", "version_major", 5);
+       return lp_parm_int(NULL, "server_info", "version_major", 5);
 }
 
 /* This hardcoded value should go into a ldb database! */
 _PUBLIC_ uint32_t dcesrv_common_get_version_minor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return lp_parm_int(-1, "server_info", "version_minor", 2);
+       return lp_parm_int(NULL, "server_info", "version_minor", 2);
 }
 
 /* This hardcoded value should go into a ldb database! */
 _PUBLIC_ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
 {
-       return lp_parm_int(-1, "server_info", "version_build", 3790);
+       return lp_parm_int(NULL, "server_info", "version_build", 3790);
 }
 
 /* This hardcoded value should go into a ldb database! */
index e51a847ee278d77d521a336470828d23e3235d7d..2b481919d12de72e419a34f702126e8b5690ae77 100644 (file)
@@ -40,12 +40,12 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
         NTSTATUS status;
        const struct ndr_interface_table *table;
         struct dcesrv_remote_private *private;
-       const char *binding = lp_parm_string(-1, "dcerpc_remote", "binding");
+       const char *binding = lp_parm_string(NULL, "dcerpc_remote", "binding");
        const char *user, *pass, *domain;
        struct cli_credentials *credentials;
        BOOL machine_account;
 
-       machine_account = lp_parm_bool(-1, "dcerpc_remote", "use_machine_account", False);
+       machine_account = lp_parm_bool(NULL, "dcerpc_remote", "use_machine_account", false);
 
        private = talloc(dce_call->conn, struct dcesrv_remote_private);
        if (!private) {
@@ -60,9 +60,9 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       user = lp_parm_string(-1, "dcerpc_remote", "user");
-       pass = lp_parm_string(-1, "dcerpc_remote", "password");
-       domain = lp_parm_string(-1, "dceprc_remote", "domain");
+       user = lp_parm_string(NULL, "dcerpc_remote", "user");
+       pass = lp_parm_string(NULL, "dcerpc_remote", "password");
+       domain = lp_parm_string(NULL, "dceprc_remote", "domain");
 
        table = ndr_table_by_uuid(&iface->syntax_id.uuid); /* FIXME: What about if_version ? */
        if (!table) {
@@ -224,7 +224,7 @@ static NTSTATUS remote_register_one_iface(struct dcesrv_context *dce_ctx, const
 static NTSTATUS remote_op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
 {
        int i;
-       const char **ifaces = str_list_make(dce_ctx, lp_parm_string(-1,"dcerpc_remote","interfaces"),NULL);
+       const char **ifaces = str_list_make(dce_ctx, lp_parm_string(NULL,"dcerpc_remote","interfaces"),NULL);
 
        if (!ifaces) {
                DEBUG(3,("remote_op_init_server: no interfaces configured\n"));
index 51888c704f589ac3010d1e4220a132e1a65253e0..84acd5069d0ba171756aa365a7064b305a250b62 100755 (executable)
@@ -139,7 +139,7 @@ sub handle_loadparm($$)
 
                my %smap = (
                            "GLOBAL" => "void",
-                           "LOCAL" => "int "
+                           "LOCAL" => "struct service *"
                            );
 
                $file->("$tmap{$type}$name($smap{$scope});\n");
index 966c803a307b92b071f7ec0234f46ce5421b39bc..53660d433f8ea4bfc5cf97f27550413afd94fe9d 100644 (file)
@@ -417,7 +417,7 @@ NTSTATUS ejs_push_array_uint8(struct ejs_rpc *ejs,
                              const uint8_t *r, uint32_t length)
 {
        DATA_BLOB blob;
-       blob.data = discard_const(r);
+       blob.data = (uint8_t *)discard_const(r);
        blob.length = length;
        mprSetVar(v, name, mprDataBlob(blob));
        return NT_STATUS_OK;
index b31b70bda8b551c323f7559322d00cd6c93b2ae1..6da978663acd566e501747d3b0876185816465c2 100644 (file)
@@ -37,7 +37,7 @@ static int ejs_lpServices(MprVarHandle eid, int argc, char **argv)
        if (argc != 0) return -1;
        
        for (i=0;i<lp_numservices();i++) {
-               list = str_list_add(list, lp_servicename(i));
+               list = str_list_add(list, lp_servicename(lp_servicebynum(i)));
        }
        talloc_steal(mprMemCtx(), list);
        mpr_Return(eid, mprList("services", list));
@@ -87,9 +87,10 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
        if (argc < 1) return -1;
 
        if (argc == 2) {
+               struct service *service;
                /* its a share parameter */
-               int snum = lp_servicenumber(argv[0]);
-               if (snum == -1) {
+               service = lp_service(argv[0]);
+               if (service == NULL) {
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
@@ -104,7 +105,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                                mpr_Return(eid, mprCreateUndefinedVar());
                                return 0;
                        }
-                       value = lp_get_parametric(snum, type, option);
+                       value = lp_get_parametric(service, type, option);
                        if (value == NULL) {
                                mpr_Return(eid, mprCreateUndefinedVar());
                                return 0;
@@ -118,7 +119,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
-               parm_ptr = lp_parm_ptr(snum, parm);
+               parm_ptr = lp_parm_ptr(service, parm);
        } else if (strchr(argv[0], ':')) {
                /* its a global parametric option */
                const char *type = talloc_strndup(mprMemCtx(), 
@@ -129,7 +130,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
-               value = lp_get_parametric(-1, type, option);
+               value = lp_get_parametric(NULL, type, option);
                if (value == NULL) {
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
@@ -143,7 +144,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
-               parm_ptr = lp_parm_ptr(-1, parm);
+               parm_ptr = lp_parm_ptr(NULL, parm);
        }
 
        if (parm == NULL || parm_ptr == NULL) {
index 2cb510b7e806cd83ac73882170a943f53cfe4e57..5cd8e076cb3c0c06025d9e436019f366d7a659b3 100644 (file)
@@ -82,7 +82,11 @@ sub end_test($$$$$$)
        my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
 
        if ($unexpected and $self->{immediate} and not $self->{verbose}) {
-               print "$testname: $result [ $reason ]\n";
+               if ($reason) {
+                       print "$testname: $result [ $reason ]\n";
+               } else {
+                       print "$testname: $result\n";
+               }
                print $self->{test_output}->{$state->{NAME}}."\n";
        }
        $self->{test_output}->{$state->{NAME}} = "";
index 2aca91adf86839ff91ac8545d7eaae8892b52be2..8aa652e27ee02949fb8a2c18d27a724057feb947 100644 (file)
@@ -196,7 +196,7 @@ void smb2srv_reply_smb_negprot(struct smbsrv_request *smb_req)
 
        req->in.size      = NBT_HDR_SIZE+SMB2_HDR_BODY+body_fixed_size;
        req->in.allocated = req->in.size;
-       req->in.buffer    = talloc_size(req, req->in.allocated);
+       req->in.buffer    = talloc_array(req, uint8_t, req->in.allocated);
        if (!req->in.buffer) goto nomem;
        req->in.hdr       = req->in.buffer + NBT_HDR_SIZE;
        req->in.body      = req->in.hdr + SMB2_HDR_BODY;
index 6a36d2f3658a5e6fd54fff22e6cd498790fc61c2..e783620e52a594f94645597d14b662d59bb06e74 100644 (file)
@@ -82,7 +82,8 @@ NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint16_t body_fixed_si
        req->out.size           = SMB2_HDR_BODY+NBT_HDR_SIZE+body_fixed_size;
 
        req->out.allocated      = req->out.size + body_dynamic_size;
-       req->out.buffer         = talloc_size(req, req->out.allocated);
+       req->out.buffer         = talloc_array(req, uint8_t, 
+                                              req->out.allocated);
        NT_STATUS_HAVE_NO_MEMORY(req->out.buffer);
 
        req->out.hdr            = req->out.buffer       + NBT_HDR_SIZE;
index b476e97168b58bd34baf707a37041957b73edc6a..6d7e19e4709a78a36dbf47b47ebb59d0a450c60b 100644 (file)
@@ -41,7 +41,8 @@ static NTSTATUS smb2srv_send_oplock_break(void *p, struct ntvfs_handle *h, uint8
        req = smb2srv_init_request(handle->tcon->smb_conn);
        NT_STATUS_HAVE_NO_MEMORY(req);
 
-       req->in.buffer          = talloc_size(req, NBT_HDR_SIZE + SMB2_MIN_SIZE);
+       req->in.buffer          = talloc_array(req, uint8_t, 
+                                              NBT_HDR_SIZE + SMB2_MIN_SIZE);
        NT_STATUS_HAVE_NO_MEMORY(req->in.buffer);
        req->in.size            = NBT_HDR_SIZE + SMB2_MIN_SIZE;
        req->in.allocated       = req->in.size;
index 84aebc9ce9f5d3a8fd4a6e8aa1abaeee3d17c73f..794fd4f5b1402194cd22101b579e68a4a31ba9c7 100644 (file)
@@ -175,7 +175,7 @@ static void stream_new_connection(struct event_context *ev,
        srv_conn->event.fde     = event_add_fd(ev, srv_conn, socket_get_fd(sock),
                                               0, stream_io_handler_fde, srv_conn);
 
-       if (!socket_check_access(sock, "smbd", lp_hostsallow(-1), lp_hostsdeny(-1))) {
+       if (!socket_check_access(sock, "smbd", lp_hostsallow(NULL), lp_hostsdeny(NULL))) {
                stream_terminate_connection(srv_conn, "denied by access rules");
                return;
        }
index e97338d3a6409b73334b70cc6a3af7c8e29d4fa7..23269a0160b9fe55fa04dc9af9f0df8e88146fda 100644 (file)
@@ -44,7 +44,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
                        gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP),
                        "Failed to start GENSEC for NTLMSSP");
 
-       gensec_ntlmssp_state = gensec_security->private_data;
+       gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
 
        gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405060708090a0b0c0d0e0f00");
        dump_data_pw("NTLMSSP session key: \n", 
@@ -98,7 +98,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
                gensec_start_mech_by_oid(gensec_security, GENSEC_OID_NTLMSSP),
                "GENSEC start mech by oid");
 
-       gensec_ntlmssp_state = gensec_security->private_data;
+       gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
 
        gensec_ntlmssp_state->session_key = strhex_to_data_blob("0102030405e538b0");
        dump_data_pw("NTLMSSP session key: \n", 
index 8b7fa20b74edbb91f5d86e5210744d83a8ad2f57..585cab9b27754909a33a0c21bd229609d882058e 100644 (file)
@@ -270,10 +270,10 @@ done:
        return ret;     
 }
 
-BOOL torture_cldap(struct torture_context *torture)
+bool torture_cldap(struct torture_context *torture)
 {
        TALLOC_CTX *mem_ctx;
-       BOOL ret = True;
+       bool ret = true;
        const char *host = torture_setting_string(torture, "host", NULL);
 
        mem_ctx = talloc_init("torture_cldap");
index 9d67e093b10df510c65ac7e6f4a8666f82616a74..9e870d9f266971c88522a5d0b10b8129c27895ab 100644 (file)
@@ -442,7 +442,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
                return werror_to_ntstatus(status);
        }
 
-       if (lp_parm_bool(-1, "become dc", "dump objects", False)) {
+       if (lp_parm_bool(NULL, "become dc", "dump objects", false)) {
                for (i=0; i < objs->num_objects; i++) {
                        struct ldb_ldif ldif;
                        fprintf(stdout, "#\n");
@@ -670,7 +670,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
                return werror_to_ntstatus(status);
        }
 
-       if (lp_parm_bool(-1, "become dc", "dump objects", False)) {
+       if (lp_parm_bool(NULL, "become dc", "dump objects", false)) {
                for (i=0; i < objs->num_objects; i++) {
                        struct ldb_ldif ldif;
                        fprintf(stdout, "#\n");
@@ -700,7 +700,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
                        return NT_STATUS_FOOBAR;
                }
 
-               if (lp_parm_bool(-1, "become dc", "dump objects", False)) {
+               if (lp_parm_bool(NULL, "become dc", "dump objects", false)) {
                        DEBUG(0,("# %s\n", sa->lDAPDisplayName));
                        NDR_PRINT_DEBUG(drsuapi_DsReplicaLinkedAttribute, &linked_attributes[i]);
                        dump_data(0,
@@ -726,7 +726,7 @@ BOOL torture_net_become_dc(struct torture_context *torture)
        s = talloc_zero(torture, struct test_become_dc_state);
        if (!s) return False;
 
-       s->netbios_name = lp_parm_string(-1, "become dc", "smbtorture dc");
+       s->netbios_name = lp_parm_string(NULL, "become dc", "smbtorture dc");
        if (!s->netbios_name || !s->netbios_name[0]) {
                s->netbios_name = "smbtorturedc";
        }
@@ -834,7 +834,7 @@ BOOL torture_net_become_dc(struct torture_context *torture)
                goto cleanup;
        }
 
-       if (lp_parm_bool(-1, "become dc", "do not unjoin", false)) {
+       if (lp_parm_bool(NULL, "become dc", "do not unjoin", false)) {
                talloc_free(s);
                return ret;
        }
index 186bd98aa5a7fd2f832bd7ce75384faf3b74f7bb..a642d4bf5216807a0075ae200b44727658b2b315 100644 (file)
@@ -418,7 +418,7 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r,
                case acct_expiry:
                        continue_if_field_set(r->in.acct_expiry);
                        now = timeval_add(&now, (random() % (31*24*60*60)), 0);
-                       r->in.acct_expiry = talloc_memdup(mem_ctx, &now, sizeof(now));
+                       r->in.acct_expiry = (struct timeval *)talloc_memdup(mem_ctx, &now, sizeof(now));
                        fldname = "acct_expiry";
                        break;
 
index 95975e630ed44a79742a0999483ed3a234c861cb..314bc6d4dafa1160587b0b92b19065d46c332b7d 100644 (file)
@@ -300,7 +300,7 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 }
 
 
-BOOL torture_userinfo(struct torture_context *torture)
+bool torture_userinfo(struct torture_context *torture)
 {
        NTSTATUS status;
        struct dcerpc_pipe *p;
index deebfd9014db2e418e3b67561e6bc727b69b2eac..51e0016ea09ace5cf3f1c69c6a035040b74377ca 100644 (file)
@@ -357,7 +357,7 @@ static BOOL test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                case acct_expiry:
                        continue_if_field_set(mod->in.change.acct_expiry);
                        now = timeval_add(&now, (random() % (31*24*60*60)), 0);
-                       mod->in.change.acct_expiry = talloc_memdup(mem_ctx, &now, sizeof(now));
+                       mod->in.change.acct_expiry = (struct timeval *)talloc_memdup(mem_ctx, &now, sizeof(now));
                        mod->in.change.fields |= USERMOD_FIELD_ACCT_EXPIRY;
                        fldname = "acct_expiry";
                        break;
@@ -533,7 +533,7 @@ done:
 }
 
 
-BOOL torture_userdel(struct torture_context *torture)
+bool torture_userdel(struct torture_context *torture)
 {
        NTSTATUS status;
        struct dcerpc_pipe *p;
index 2a9eb49d010a288f79a7b79e64fde98fac03ced4..fb4e5c3c3ad9b109326ce33104e5f0b773d0a3a4 100644 (file)
@@ -29,7 +29,8 @@
 
 float tdb_speed;
 
-static BOOL tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1, const char *fmt2, int i)
+static bool tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1, 
+                          const char *fmt2, int i)
 {
        TDB_DATA key, data;
        int ret;
index e2c7de1c723252a60d89289980aa1cb56d113e12..46acf5938e527d0bfe464c11fb8ebaebd36f27c7 100644 (file)
@@ -29,7 +29,7 @@ static int fde_count;
 static void fde_handler(struct event_context *ev_ctx, struct fd_event *f, 
                        uint16_t flags, void *private)
 {
-       int *fd = private;
+       int *fd = (int *)private;
        char c;
 #ifdef SA_SIGINFO
        kill(getpid(), SIGUSR1);
@@ -43,14 +43,14 @@ static void fde_handler(struct event_context *ev_ctx, struct fd_event *f,
 static void finished_handler(struct event_context *ev_ctx, struct timed_event *te,
                             struct timeval tval, void *private)
 {
-       int *finished = private;
+       int *finished = (int *)private;
        (*finished) = 1;
 }
 
 static void count_handler(struct event_context *ev_ctx, struct signal_event *te,
                          int signum, int count, void *info, void *private)
 {
-       int *countp = private;
+       int *countp = (int *)private;
        (*countp) += count;
 }
 
index 8c2d5a305499b48216459e3f497673ed41427255..06659b5e9ccff5e26215426f587e890552814df3 100644 (file)
@@ -34,7 +34,7 @@ static bool iconv_untestable(struct torture_context *tctx)
 {
        iconv_t cd;
 
-       if (!lp_parm_bool(-1, "iconv", "native", true))
+       if (!lp_parm_bool(NULL, "iconv", "native", true))
                torture_skip(tctx, "system iconv disabled - skipping test");
 
        cd = iconv_open("UTF-16LE", "UCS-4LE");
@@ -314,10 +314,10 @@ static bool test_codepoint(struct torture_context *tctx, unsigned int codepoint)
 
 static bool test_next_codepoint(struct torture_context *tctx)
 {
+       unsigned int codepoint;
        if (iconv_untestable(tctx))
                return true;
 
-       unsigned int codepoint;
        for (codepoint=0;codepoint<(1<<20);codepoint++) {
                if (!test_codepoint(tctx, codepoint))
                        return false;
@@ -403,13 +403,13 @@ struct torture_suite *torture_local_iconv(TALLOC_CTX *mem_ctx)
        struct torture_suite *suite = torture_suite_create(mem_ctx, "ICONV");
 
        torture_suite_add_simple_test(suite, "next_codepoint()",
-                                                                  test_next_codepoint);
+                                     test_next_codepoint);
 
        torture_suite_add_simple_test(suite, "first 1M codepoints",
-                                                                  test_first_1m);
+                                     test_first_1m);
 
        torture_suite_add_simple_test(suite, "5M random UTF-16LE sequences",
-                                                                  test_random_5m);
+                                     test_random_5m);
        return suite;
 }
 
index 7c5de2dd5665a42346d05749168b12de64c0daf9..e113b63804a2f290e8c1b0324e74c350021d86ac 100644 (file)
@@ -86,7 +86,7 @@ static bool test_addone(struct torture_context *test, const void *_data,
 {
        struct echo_AddOne r;
        NTSTATUS status;
-       const struct irpc_test_data *data = _data;
+       const struct irpc_test_data *data = (const struct irpc_test_data *)_data;
        uint32_t value = (uint32_t)_value;
 
        /* make the call */
@@ -115,7 +115,7 @@ static bool test_echodata(struct torture_context *tctx,
 {
        struct echo_EchoData r;
        NTSTATUS status;
-       const struct irpc_test_data *data = tcase_data;
+       const struct irpc_test_data *data = (const struct irpc_test_data *)tcase_data;
        TALLOC_CTX *mem_ctx = tctx;
 
        /* make the call */
@@ -144,7 +144,7 @@ static bool test_echodata(struct torture_context *tctx,
 
 static void irpc_callback(struct irpc_request *irpc)
 {
-       struct echo_AddOne *r = irpc->r;
+       struct echo_AddOne *r = (struct echo_AddOne *)irpc->r;
        int *pong_count = (int *)irpc->async.private;
        NTSTATUS status = irpc_call_recv(irpc);
        if (!NT_STATUS_IS_OK(status)) {
@@ -166,7 +166,7 @@ static bool test_speed(struct torture_context *tctx,
 {
        int ping_count = 0;
        int pong_count = 0;
-       const struct irpc_test_data *data = tcase_data;
+       const struct irpc_test_data *data = (const struct irpc_test_data *)tcase_data;
        struct timeval tv;
        struct echo_AddOne r;
        TALLOC_CTX *mem_ctx = tctx;
index ac10627783dae50f46b0af952070b63e7b8d5da3..3e6382309e2ea27e0d0fb6e32f848ea3f8f8182a 100644 (file)
@@ -33,7 +33,7 @@ static bool test_sddl(struct torture_context *tctx,
 {
        struct security_descriptor *sd, *sd2;
        struct dom_sid *domain;
-       const char *sddl = test_data;
+       const char *sddl = (const char *)test_data;
        const char *sddl2;
        TALLOC_CTX *mem_ctx = tctx;
 
index 528f34f8617426a7f13fe276195db77312addb58..a4250bccf9fe2f8c292075a8183bef85ffcfb0be 100644 (file)
@@ -27,7 +27,7 @@ static bool test_list_empty(struct torture_context *tctx,
                            const void *tcase_data, 
                            const void *test_data)
 {
-       struct share_context *ctx = discard_const(tcase_data);
+       struct share_context *ctx = (struct share_context *)discard_const(tcase_data);
        int count;
        const char **names;
 
@@ -41,7 +41,7 @@ static bool test_create(struct torture_context *tctx,
                        const void *tcase_data, 
                        const void *test_data)
 {
-       struct share_context *ctx = discard_const(tcase_data);
+       struct share_context *ctx = (struct share_context *)discard_const(tcase_data);
        int count;
        const char **names;
        int i;
@@ -79,7 +79,7 @@ static bool test_create_invalid(struct torture_context *tctx,
                                const void *tcase_data, 
                                const void *test_data)
 {
-       struct share_context *ctx = discard_const(tcase_data);
+       struct share_context *ctx = (struct share_context *)discard_const(tcase_data);
        NTSTATUS status;
 
        status = share_create(ctx, "bla", NULL, 0);
@@ -102,7 +102,7 @@ static bool test_share_remove_invalid(struct torture_context *tctx,
                                      const void *tcase_data, 
                                      const void *test_data)
 {
-       struct share_context *ctx = discard_const(tcase_data);
+       struct share_context *ctx = (struct share_context *)discard_const(tcase_data);
        NTSTATUS status;
 
        status = share_remove(ctx, "nonexistant");
@@ -121,7 +121,7 @@ static bool test_share_remove(struct torture_context *tctx,
                              const void *tcase_data, 
                              const void *test_data)
 {
-       struct share_context *ctx = discard_const(tcase_data);
+       struct share_context *ctx = (struct share_context *)discard_const(tcase_data);
        struct share_info inf[] = { 
                { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") },
                { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") }
@@ -144,7 +144,7 @@ static bool test_double_create(struct torture_context *tctx,
                               const void *tcase_data, 
                               const void *test_data)
 {
-       struct share_context *ctx = discard_const(tcase_data);
+       struct share_context *ctx = (struct share_context *)discard_const(tcase_data);
        struct share_info inf[] = { 
                { SHARE_INFO_STRING, SHARE_TYPE, discard_const_p(void *, "IPC$") },
                { SHARE_INFO_STRING, SHARE_PATH, discard_const_p(void *, "/tmp/bla") }
index 4f0bfa8e060c9f7cea5910c94fe6b1421d284537..d18a1cb6e91e4acf75a47c070ae71e01f74e0526 100644 (file)
@@ -123,7 +123,7 @@ static struct smbcli_state *connect_one(char *share, int snum, int conn)
                char **unc_list = NULL;
                int num_unc_names;
                const char *p;
-               p = lp_parm_string(-1, "torture", "unclist");
+               p = lp_parm_string(NULL, "torture", "unclist");
                if (p) {
                        char *h, *s;
                        unc_list = file_lines_load(p, &num_unc_names, NULL);
index 768c8db63ea209a18927a9572175925bf1a1e286..a72a03fa3858ed0e80cba95003257553a1bbf1fa 100644 (file)
@@ -1747,7 +1747,7 @@ static const uint8_t lsarlookupsids3_out_data[] = {
 };
 
 static bool lsarlookupsids3_out_check(struct torture_context *tctx, 
-                                                                        struct lsa_LookupSids3 *r)
+                                     struct lsa_LookupSids3 *r)
 {
        /* FIXME: Handle */
        torture_assert(tctx, r->out.names != NULL, "names ptr");
index 5c7dfc7c29a1afed2b1684dc1bdf2378e7e0e9f5..18ede54867e33a6b9f12e0feb03987097fa5025d 100644 (file)
@@ -36,7 +36,7 @@ static bool wrap_ndr_pull_test(struct torture_context *tctx,
                                                           struct torture_test *test)
 {
        bool (*check_fn) (struct torture_context *ctx, void *data) = test->fn;
-       const struct ndr_pull_test_data *data = test->data;
+       const struct ndr_pull_test_data *data = (const struct ndr_pull_test_data *)test->data;
        void *ds = talloc_zero_size(tctx, data->struct_size);
        struct ndr_pull *ndr = ndr_pull_init_blob(&(data->data), tctx);
 
index d7c956efd6fdc25f993f18ce14c2c99d2bf96ee2..ab256a7152bba302fa4169e0da4f24c182ec75e0 100644 (file)
@@ -240,7 +240,7 @@ static const uint8_t querymultiplevalues_in_data[] = {
 };
 
 static bool querymultiplevalues_in_check(struct torture_context *tctx, 
-                                                                                struct winreg_QueryMultipleValues *r)
+                                        struct winreg_QueryMultipleValues *r)
 {
        torture_assert_int_equal(tctx, r->in.num_values, 1, "num values");
        torture_assert_str_equal(tctx, r->in.values[0].name->name, "HOMEPATH", 
@@ -272,7 +272,7 @@ static const uint8_t querymultiplevalues_out_data[] = {
 };
 
 static bool querymultiplevalues_out_check(struct torture_context *tctx, 
-                                                                                struct winreg_QueryMultipleValues *r)
+                                         struct winreg_QueryMultipleValues *r)
 {
        torture_assert_str_equal(tctx, r->out.values[0].name->name, "HOMEPATH", 
                                                         "name");
@@ -458,7 +458,7 @@ static const uint8_t getkeysecurity_in_data[] = {
 };
 
 static bool getkeysecurity_in_check(struct torture_context *tctx, 
-                                                                       struct winreg_GetKeySecurity *r)
+                                   struct winreg_GetKeySecurity *r)
 {
        /* FIXME: Handle */
        torture_assert_int_equal(tctx, r->in.sec_info, 2, "sec info");
@@ -476,7 +476,7 @@ static const uint8_t getkeysecurity_out_data[] = {
 };
 
 static bool getkeysecurity_out_check(struct torture_context *tctx, 
-                                                                        struct winreg_GetKeySecurity *r)
+                                    struct winreg_GetKeySecurity *r)
 {
        torture_assert_int_equal(tctx, r->in.sd->size, 20, "sd size");
        torture_assert_int_equal(tctx, r->in.sd->len, 20, "sd len");
index 026384cb8bba415a904c5640839c951a55545c49..ab112658e2aad3f231255b15105cd1beeac16d8d 100644 (file)
@@ -1736,7 +1736,7 @@ done:
 */
 bool torture_raw_acls(struct torture_context *tctx, struct smbcli_state *cli)
 {
-       BOOL ret = True;
+       bool ret = true;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
index ea5c09c335942bfa1a55cb00cea2f5743a94d499..370c1f510b060d64f5b30b01c0a4ced8b8950688 100644 (file)
@@ -87,7 +87,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        printf("waiting for completion\n");
        while (*count != num_ops) {
                event_loop_once(cli->transport->socket->event.ctx);
-               if (lp_parm_bool(-1, "torture", "progress", true)) {
+               if (lp_parm_bool(NULL, "torture", "progress", true)) {
                        printf("count=%d\r", *count);
                        fflush(stdout);
                }
@@ -152,10 +152,10 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                return False;
        }
 
-       io2.in.dest_host = lp_parm_string(-1, "torture", "host");
+       io2.in.dest_host = lp_parm_string(NULL, "torture", "host");
        io2.in.port = 0;
-       io2.in.called_name = lp_parm_string(-1, "torture", "host");
-       io2.in.service = lp_parm_string(-1, "torture", "share");
+       io2.in.called_name = lp_parm_string(NULL, "torture", "host");
+       io2.in.service = lp_parm_string(NULL, "torture", "share");
        io2.in.service_type = "A:";
 
        io2.in.credentials = cmdline_credentials;
@@ -177,7 +177,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 
        while (*count != torture_numops) {
                event_loop_once(event_ctx);
-               if (lp_parm_bool(-1, "torture", "progress", true)) {
+               if (lp_parm_bool(NULL, "torture", "progress", true)) {
                        printf("count=%d\r", *count);
                        fflush(stdout);
                }
@@ -297,7 +297,7 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        printf("waiting for completion\n");
        while (*count != num_ops) {
                event_loop_once(event_ctx);
-               if (lp_parm_bool(-1, "torture", "progress", true)) {
+               if (lp_parm_bool(NULL, "torture", "progress", true)) {
                        printf("count=%d\r", *count);
                        fflush(stdout);
                }
@@ -340,10 +340,10 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        int *count = talloc_zero(mem_ctx, int);
        BOOL ret = True;
 
-       io1.in.dest_host = lp_parm_string(-1, "torture", "host");
+       io1.in.dest_host = lp_parm_string(NULL, "torture", "host");
        io1.in.port = 0;
-       io1.in.called_name = lp_parm_string(-1, "torture", "host");
-       io1.in.service = lp_parm_string(-1, "torture", "share");
+       io1.in.called_name = lp_parm_string(NULL, "torture", "host");
+       io1.in.service = lp_parm_string(NULL, "torture", "share");
        io1.in.service_type = "A:";
        io1.in.credentials = cmdline_credentials;
        io1.in.workgroup = lp_workgroup();
@@ -364,7 +364,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 
        while (*count < torture_numops) {
                event_loop_once(event_ctx);
-               if (lp_parm_bool(-1, "torture", "progress", true)) {
+               if (lp_parm_bool(NULL, "torture", "progress", true)) {
                        printf("count=%d\r", *count);
                        fflush(stdout);
                }
index 79771a004d7e238e55db8b8b47bad24e4b116911..dacc9958be141bd0832f383fa454763529afefa7 100644 (file)
@@ -277,8 +277,8 @@ static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                return False;
        }
 
-       share = lp_parm_string(-1, "torture", "share");
-       host  = lp_parm_string(-1, "torture", "host");
+       share = lp_parm_string(NULL, "torture", "share");
+       host  = lp_parm_string(NULL, "torture", "host");
        
        printf("create a second tree context on the same session\n");
        tree = smbcli_tree_init(cli->session, mem_ctx, False);
@@ -385,8 +385,8 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                return False;
        }
 
-       share = lp_parm_string(-1, "torture", "share");
-       host  = lp_parm_string(-1, "torture", "host");
+       share = lp_parm_string(NULL, "torture", "share");
+       host  = lp_parm_string(NULL, "torture", "host");
 
        printf("create the first new sessions\n");
        session1 = smbcli_session_init(cli->transport, mem_ctx, False);
@@ -746,8 +746,8 @@ static BOOL test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                return False;
        }
 
-       share = lp_parm_string(-1, "torture", "share");
-       host  = lp_parm_string(-1, "torture", "host");
+       share = lp_parm_string(NULL, "torture", "share");
+       host  = lp_parm_string(NULL, "torture", "host");
        
        printf("create a second tree context on the same session\n");
        tree = smbcli_tree_init(cli->session, mem_ctx, False);
index 5e8056438049857d1b4cb7ec09d8d50ab74e3481..810667134a011f3c2a7f9c5fcd2dafdea52627e8 100644 (file)
@@ -247,10 +247,10 @@ static BOOL test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("TESTING SETFILEINFO MAX. EA_SET\n");
 
-       maxeasize  = lp_parm_int(-1, "torture", "maxeasize", 65536);
-       maxeanames = lp_parm_int(-1, "torture", "maxeanames", 101);
-       maxeastart = lp_parm_int(-1, "torture", "maxeastart", 1);
-       maxeadebug = lp_parm_int(-1, "torture", "maxeadebug", 0);
+       maxeasize  = lp_parm_int(NULL, "torture", "maxeasize", 65536);
+       maxeanames = lp_parm_int(NULL, "torture", "maxeanames", 101);
+       maxeastart = lp_parm_int(NULL, "torture", "maxeastart", 1);
+       maxeadebug = lp_parm_int(NULL, "torture", "maxeadebug", 0);
 
        /* Do some sanity check on possibly passed parms */
        if (maxeasize <= 0) {
@@ -447,7 +447,7 @@ done:
 */
 bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli)
 {
-       BOOL ret = True;
+       bool ret = true;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return False;
index e4ab9d9e4a090808540c21931024d8b55a3c6df1..c47f3c797873d5de9f9ef76d5c3d6fdd215ff217 100644 (file)
@@ -599,8 +599,8 @@ static bool test_async(struct torture_context *tctx,
        session->vuid = setup.out.vuid;
 
        printf("create new tree context\n");
-       share = lp_parm_string(-1, "torture", "share");
-       host  = lp_parm_string(-1, "torture", "host");
+       share = lp_parm_string(NULL, "torture", "share");
+       host  = lp_parm_string(NULL, "torture", "host");
        tree = smbcli_tree_init(session, tctx, False);
        tcon.generic.level = RAW_TCON_TCONX;
        tcon.tconx.in.flags = 0;
index 6ef33be75987c8352611a7d6ebf07c10b9375160..55cab9e1178e0fadf0ae8b0a368ffcbb7f650146 100644 (file)
@@ -318,7 +318,7 @@ BOOL torture_bench_lock(struct torture_context *torture)
 
        progress = torture_setting_bool(torture, "progress", true);
 
-       nprocs = lp_parm_int(-1, "torture", "nprocs", 4);
+       nprocs = lp_parm_int(NULL, "torture", "nprocs", 4);
 
        state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs);
 
index c4d7bc253466bf5465efcc97ed4e0bd585e55379..2df2c6c84e89cf6a4bc8b9d1b9afa8c75f466fca 100644 (file)
@@ -130,7 +130,7 @@ static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        md.t2mkdir.in.eas[2].value = data_blob_talloc(mem_ctx, "xx1", 3);
        status = smb_raw_mkdir(cli->tree, &md);
 
-       if (lp_parm_bool(-1, "torture", "samba3", False)
+       if (lp_parm_bool(NULL, "torture", "samba3", false)
            && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)) {
                d_printf("EAS not supported -- not treating as fatal\n");
        }
index b67d756ed95c80fa7326edbfc10a03fdcf2a191a..95ba319eea2057d8fed4650e6fa20c4a8852c5e9 100644 (file)
@@ -176,7 +176,7 @@ static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        io.writex.in.wmode = 0;
        io.writex.in.remaining = 0;
        io.writex.in.count = 4;
-       io.writex.in.data = (void *)&fnum;      
+       io.writex.in.data = (const uint8_t *)&fnum;     
        req = smb_raw_write_send(cli->tree, &io);
 
        /* unlock the range */
index d744a891e5f979c3b16b79f5e59423f8c4039edf..b9d1d07b5e325c46f71f9bcf400acfd27aeccd3f 100644 (file)
@@ -434,7 +434,6 @@ static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct
        union smb_open io;
        int fnum;
        struct smbcli_request *req1, *req2;
-       union smb_setfileinfo sfinfo;
 
        printf("TESTING CHANGE NOTIFY WITH MASK CHANGE\n");
 
@@ -712,7 +711,7 @@ static BOOL test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
 
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                printf("Samba3 does not yet support create times "
                       "everywhere\n");
        }
index 104a2056e30dad883a130781df1647c680b14bd9..c0a32e00f4881ae416da66083f45bbc0d6297c36 100644 (file)
@@ -398,7 +398,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        io.openx.in.file_attrs = FILE_ATTRIBUTE_SYSTEM;
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, 
                               attrib & ~(FILE_ATTRIBUTE_NONINDEXED|
                                          FILE_ATTRIBUTE_SPARSE));
@@ -569,7 +569,7 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                status = smb_raw_open(cli->tree, mem_ctx, &io);
                if ((io.t2open.in.num_eas != 0)
                    && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)
-                   && lp_parm_bool(-1, "torture", "samba3", False)) {
+                   && lp_parm_bool(NULL, "torture", "samba3", false)) {
                        printf("(%s) EAs not supported, not treating as fatal "
                               "in Samba3 test\n", __location__);
                        io.t2open.in.num_eas = 0;
@@ -1346,8 +1346,8 @@ static BOOL test_raw_open_multi(void)
        struct smbcli_state **clients;
        struct smbcli_request **requests;
        union smb_open *ios;
-       const char *host = lp_parm_string(-1, "torture", "host");
-       const char *share = lp_parm_string(-1, "torture", "share");
+       const char *host = lp_parm_string(NULL, "torture", "host");
+       const char *share = lp_parm_string(NULL, "torture", "share");
        int i, num_files = 3;
        struct event_context *ev;
        int num_ok = 0;
index 6841253c91ef1017ad0fa42c43154451e4c7be75..6d84ff1ae9400f797f4e8da00758358b2880278c 100755 (executable)
 #include "torture/util.h"
 #include "param/param.h"
 
-
-
-
-void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout)
+static void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout)
 {
        union smb_lock io;
        struct smb_lock_entry lock;
@@ -93,7 +90,7 @@ try_again:
        }
 }
 
-void unlock_byte(struct smbcli_state *cli, int fd, int offset)
+static void unlock_byte(struct smbcli_state *cli, int fd, int offset)
 {
        union smb_lock io;
        struct smb_lock_entry lock;
@@ -120,7 +117,7 @@ void unlock_byte(struct smbcli_state *cli, int fd, int offset)
        }
 }
 
-void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
+static void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
 {
        union smb_write io;
        NTSTATUS status;
@@ -140,7 +137,7 @@ void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
        }
 }      
 
-void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
+static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
 {
        union smb_read io;
        NTSTATUS status;
@@ -179,7 +176,7 @@ static double end_timer(void)
 /* 
    ping pong
 */
-BOOL torture_ping_pong(struct torture_context *torture)
+bool torture_ping_pong(struct torture_context *torture)
 {
        const char *fn;
        int num_locks;
@@ -194,21 +191,21 @@ BOOL torture_ping_pong(struct torture_context *torture)
        uint8_t *val;
        int count, loops;
 
-       fn = lp_parm_string(-1, "torture", "filename");
+       fn = lp_parm_string(NULL, "torture", "filename");
        if (fn == NULL) {
                DEBUG(0,("You must specify the filename using --option=torture:filename=...\n"));
                return false;
        }
 
-       num_locks = lp_parm_int(-1, "torture", "num_locks", -1);
+       num_locks = lp_parm_int(NULL, "torture", "num_locks", -1);
        if (num_locks == -1) {
                DEBUG(0,("You must specify num_locks using --option=torture:num_locks=...\n"));
                return false;
        }
 
-       do_reads     = lp_parm_bool(-1, "torture", "read", False);
-       do_writes    = lp_parm_bool(-1, "torture", "write", False);
-       lock_timeout =  lp_parm_int(-1, "torture", "lock_timeout", 100000);
+       do_reads     = lp_parm_bool(NULL, "torture", "read", false);
+       do_writes    = lp_parm_bool(NULL, "torture", "write", false);
+       lock_timeout =  lp_parm_int(NULL, "torture", "lock_timeout", 100000);
 
        if (!torture_open_connection(&cli, 0)) {
                DEBUG(0,("Could not open connection\n"));
index dc09e55b63999e8feb3e0fc222f8e15df5d27b45..05e6f78324116e1ffb87e9a5964c4ae2e1c0572f 100644 (file)
@@ -121,7 +121,7 @@ static union smb_fsinfo *find(const char *name)
    quiescent, which is sometimes hard to achieve
 */
 bool torture_raw_qfsinfo(struct torture_context *torture, 
-                                                struct smbcli_state *cli)
+                        struct smbcli_state *cli)
 {
        int i;
        BOOL ret = True;
index b00b377c7f8908d5f13c95c90246050880d8ecf7..61bf027ae8a2590f02b26b3ca560708196585cbb 100644 (file)
@@ -482,7 +482,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
        CHECK_STATUS(status, NT_STATUS_OK);
        CHECK_VALUE(io.readx.out.remaining, 0xFFFF);
        CHECK_VALUE(io.readx.out.compaction_mode, 0);
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                printf("SAMBA3: large read extension\n");
                CHECK_VALUE(io.readx.out.nread, 80000);
        } else {
@@ -526,7 +526,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
                io.readx.in.maxcnt = 0x10000;
                status = smb_raw_read(cli->tree, &io);
                CHECK_STATUS(status, NT_STATUS_OK);
-               if (lp_parm_bool(-1, "torture", "samba3", False)) {
+               if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                        printf("SAMBA3: large read extension\n");
                        CHECK_VALUE(io.readx.out.nread, 0x10000);
                } else {
@@ -536,7 +536,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli)
                io.readx.in.maxcnt = 0x10001;
                status = smb_raw_read(cli->tree, &io);
                CHECK_STATUS(status, NT_STATUS_OK);
-               if (lp_parm_bool(-1, "torture", "samba3", False)) {
+               if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                        printf("SAMBA3: large read extension\n");
                        CHECK_VALUE(io.readx.out.nread, 0x10001);
                } else {
index c51c6ea2dfb221d6b6791c04f2b43f3366b228db..81181e49ab56da37b9af7fea824647204c1367f0 100644 (file)
@@ -214,9 +214,9 @@ done:
    basic testing of streams calls
 */
 bool torture_raw_streams(struct torture_context *torture, 
-                                                struct smbcli_state *cli)
+                        struct smbcli_state *cli)
 {
-       BOOL ret = True;
+       bool ret = true;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return False;
index 59e1aeb27c7be2daac761f71c0e787889df7b764..88f9a71aaf092d21d596c42195fb150713ed0a70 100644 (file)
@@ -129,7 +129,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
        io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY;
        status = smb_raw_unlink(cli->tree, &io);
 
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                /*
                 * In Samba3 we gave up upon getting the error codes in
                 * wildcard unlink correct. Trying gentest showed that this is
@@ -157,7 +157,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
        io.unlink.in.pattern = BASEDIR "\\t*";
        io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY;
        status = smb_raw_unlink(cli->tree, &io);
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
        }
        else {
@@ -169,7 +169,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
        io.unlink.in.pattern = BASEDIR "\\*.dat";
        io.unlink.in.attrib = FILE_ATTRIBUTE_DIRECTORY;
        status = smb_raw_unlink(cli->tree, &io);
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
        }
        else {
@@ -179,7 +179,7 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli)
        io.unlink.in.pattern = BASEDIR "\\*.tx?";
        io.unlink.in.attrib = 0;
        status = smb_raw_unlink(cli->tree, &io);
-       if (lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba3", false)) {
                CHECK_STATUS(status, NT_STATUS_NO_SUCH_FILE);
        }
        else {
@@ -282,7 +282,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
 
 
-       if (!lp_parm_bool(-1, "torture", "samba3", False)) {
+       if (!lp_parm_bool(NULL, "torture", "samba3", false)) {
 
                /*
                 * Known deficiency, also skipped in base-delete.
index 76d838517cd84bbe4ecf094df75e1e939da27234..451b8ab120194bdd59fcc80014ffcb734f3f9f01 100644 (file)
@@ -95,8 +95,7 @@ static void reopen(TALLOC_CTX *mem_ctx,
 
        talloc_free(*p);
 
-       status = torture_rpc_connection(mem_ctx, 
-                                       p, iface);
+       status = torture_rpc_connection(mem_ctx, p, iface);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to reopen '%s' - %s\n", iface->name, nt_errstr(status));
                exit(1);
index be00e0b7a6ad72355e381b0ad917620af72a084f..7f71723e6ddcb68ac56d1d016bbc1a8215df6645 100644 (file)
@@ -72,7 +72,7 @@ static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
        struct timeval tv = timeval_current();
        BOOL ret = True;
-       int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
+       int timelimit = lp_parm_int(NULL, "torture", "timelimit", 10);
        int count=0;
 
        printf("Running for %d seconds\n", timelimit);
@@ -82,7 +82,7 @@ static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
                talloc_free(tmp_ctx);
                count++;
                if (count % 50 == 0) {
-                       if (lp_parm_bool(-1, "torture", "progress", true)) {
+                       if (lp_parm_bool(NULL, "torture", "progress", true)) {
                                printf("%.1f queries per second  \r", 
                                       count / timeval_elapsed(&tv));
                        }
index c1fdc069cb0741de89d236dae064b5e320689e19..0d3df0ffb344327e09c5f252662f5ed93fd733c2 100644 (file)
@@ -111,7 +111,7 @@ BOOL torture_rpc_countcalls(struct torture_context *torture)
        if (!mem_ctx) {
                return False;
        }
-       iface_name = lp_parm_string(-1, "countcalls", "interface");
+       iface_name = lp_parm_string(NULL, "countcalls", "interface");
        if (iface_name != NULL) {
                iface = ndr_table_by_name(iface_name);
                if (!iface) {
index c3ec54cbcdbe6ac5b6eaad921e2ad4ac767d365d..3f59f1d56d0b18f26ac68b0c319d3e5719ed759a 100644 (file)
@@ -538,7 +538,7 @@ static bool test_DsGetNCChanges(struct torture_context *tctx,
                        r.in.req.req5.highwatermark.highest_usn         = 0;
                        r.in.req.req5.uptodateness_vector               = NULL;
                        r.in.req.req5.replica_flags                     = 0;
-                       if (lp_parm_bool(-1, "drsuapi", "compression", false)) {
+                       if (lp_parm_bool(NULL, "drsuapi", "compression", false)) {
                                r.in.req.req5.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
                        r.in.req.req5.max_object_count                  = 0;
@@ -560,10 +560,10 @@ static bool test_DsGetNCChanges(struct torture_context *tctx,
                        r.in.req.req8.highwatermark.highest_usn         = 0;
                        r.in.req.req8.uptodateness_vector               = NULL;
                        r.in.req.req8.replica_flags                     = 0;
-                       if (lp_parm_bool(-1, "drsuapi", "compression", false)) {
+                       if (lp_parm_bool(NULL, "drsuapi", "compression", false)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
-                       if (lp_parm_bool(-1, "drsuapi", "neighbour_writeable",true)) {
+                       if (lp_parm_bool(NULL, "drsuapi", "neighbour_writeable",true)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
                        }
                        r.in.req.req8.replica_flags                     |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
index bf3e59c380b948d9159f8253bb483712e00f3def..5ea578e0416cc001a9f81c276638784ab6744c3f 100644 (file)
@@ -84,7 +84,7 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
        struct DsSyncTest *ctx;
        struct drsuapi_DsBindInfo28 *our_bind_info28;
        struct drsuapi_DsBindInfoCtr *our_bind_info_ctr;
-       const char *binding = lp_parm_string(-1, "torture", "binding");
+       const char *binding = lp_parm_string(NULL, "torture", "binding");
        ctx = talloc_zero(mem_ctx, struct DsSyncTest);
        if (!ctx) return NULL;
 
@@ -149,7 +149,7 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx)
        our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3;
        our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7;
        our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT;
-       if (lp_parm_bool(-1,"dssync","xpress",False)) {
+       if (lp_parm_bool(NULL, "dssync", "xpress", false)) {
                our_bind_info28->supported_extensions   |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS;
        }
        our_bind_info28->site_guid              = GUID_zero();
@@ -420,11 +420,11 @@ static void test_analyse_objects(struct DsSyncTest *ctx,
        static uint32_t object_id;
        const char *save_values_dir;
 
-       if (!lp_parm_bool(-1,"dssync","print_pwd_blobs", false)) {
+       if (!lp_parm_bool(NULL,"dssync","print_pwd_blobs", false)) {
                return; 
        }
 
-       save_values_dir = lp_parm_string(-1,"dssync","save_pwd_blobs_dir");
+       save_values_dir = lp_parm_string(NULL, "dssync", "save_pwd_blobs_dir");
 
        for (; cur; cur = cur->next_object) {
                const char *dn;
@@ -560,17 +560,17 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
        ZERO_STRUCT(null_guid);
        ZERO_STRUCT(null_sid);
 
-       partition = lp_parm_string(-1, "dssync", "partition");
+       partition = lp_parm_string(NULL, "dssync", "partition");
        if (partition == NULL) {
                partition = ctx->domain_dn;
                printf("dssync:partition not specified, defaulting to %s.\n", ctx->domain_dn);
        }
 
-       highest_usn = lp_parm_int(-1, "dssync", "highest_usn", 0);
+       highest_usn = lp_parm_int(NULL, "dssync", "highest_usn", 0);
 
-       array[0].level = lp_parm_int(-1, "dssync", "get_nc_changes_level", array[0].level);
+       array[0].level = lp_parm_int(NULL, "dssync", "get_nc_changes_level", array[0].level);
 
-       if (lp_parm_bool(-1,"dssync","print_pwd_blobs",False)) {
+       if (lp_parm_bool(NULL, "dssync", "print_pwd_blobs", false)) {
                const struct samr_Password *nthash;
                nthash = cli_credentials_get_nt_hash(ctx->new_dc.credentials, ctx);
                if (nthash) {
@@ -606,10 +606,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
                        r.in.req.req5.highwatermark.highest_usn         = highest_usn;
                        r.in.req.req5.uptodateness_vector               = NULL;
                        r.in.req.req5.replica_flags                     = 0;
-                       if (lp_parm_bool(-1,"dssync","compression",False)) {
+                       if (lp_parm_bool(NULL, "dssync", "compression", false)) {
                                r.in.req.req5.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
-                       if (lp_parm_bool(-1,"dssync","neighbour_writeable",True)) {
+                       if (lp_parm_bool(NULL, "dssync", "neighbour_writeable", true)) {
                                r.in.req.req5.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
                        }
                        r.in.req.req5.replica_flags                     |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
@@ -637,10 +637,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx)
                        r.in.req.req8.highwatermark.highest_usn         = highest_usn;
                        r.in.req.req8.uptodateness_vector               = NULL;
                        r.in.req.req8.replica_flags                     = 0;
-                       if (lp_parm_bool(-1,"dssync","compression",False)) {
+                       if (lp_parm_bool(NULL, "dssync", "compression", false)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
                        }
-                       if (lp_parm_bool(-1,"dssync","neighbour_writeable",True)) {
+                       if (lp_parm_bool(NULL, "dssync", "neighbour_writeable", true)) {
                                r.in.req.req8.replica_flags             |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
                        }
                        r.in.req.req8.replica_flags                     |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
@@ -760,8 +760,8 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
        r.in.bind_handle        = &ctx->new_dc.drsuapi.bind_handle;
        r.in.level              = 1;
 
-       r.in.req.req1.unknown1  = lp_parm_int(-1, "dssync", "nt4-1", 3);
-       r.in.req.req1.unknown2  = lp_parm_int(-1, "dssync", "nt4-2", 0x00004000);
+       r.in.req.req1.unknown1  = lp_parm_int(NULL, "dssync", "nt4-1", 3);
+       r.in.req.req1.unknown2  = lp_parm_int(NULL, "dssync", "nt4-2", 0x00004000);
 
        while (1) {
                r.in.req.req1.length    = cookie.length;
@@ -800,9 +800,9 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx)
        return ret;
 }
 
-BOOL torture_rpc_dssync(struct torture_context *torture)
+bool torture_rpc_dssync(struct torture_context *torture)
 {
-       BOOL ret = True;
+       bool ret = true;
        TALLOC_CTX *mem_ctx;
        struct DsSyncTest *ctx;
        
index 52f6d76d0e6c07d759d89939a4139ac682ab217e..c873cdf0aee3c861be654818e1f1bb6439ae9b3d 100644 (file)
@@ -78,8 +78,8 @@ static bool test_echodata(struct torture_context *tctx,
                len = 1 + (random() % 5000);
        }
 
-       data_in = talloc_size(tctx, len);
-       data_out = talloc_size(tctx, len);
+       data_in = talloc_array(tctx, uint8_t, len);
+       data_out = talloc_array(tctx, uint8_t, len);
        for (i=0;i<len;i++) {
                data_in[i] = i;
        }
@@ -159,7 +159,7 @@ static bool test_sinkdata(struct torture_context *tctx,
                len = 200000 + (random() % 5000);
        }
 
-       data_in = talloc_size(tctx, len);
+       data_in = talloc_array(tctx, uint8_t, len);
        for (i=0;i<len;i++) {
                data_in[i] = i+1;
        }
index 539923a2e02ca777805dd4a33f10c7d95cc7278c..c1d863454cd3f86f83c9804f925a1fb84ef62379 100644 (file)
@@ -125,7 +125,7 @@ static bool test_ReadEventLog(struct torture_context *tctx,
                /* Now read the actual record */
 
                r.in.number_of_bytes = *r.out.real_size;
-               r.out.data = talloc_size(tctx, r.in.number_of_bytes);
+               r.out.data = talloc_array(tctx, uint8_t, r.in.number_of_bytes);
 
                status = dcerpc_eventlog_ReadEventLogW(p, tctx, &r);
 
index 46660231f8bfc6b665b9af701f2160af3d8ee68b..2cc2b78a788ba52e2a89976d8bc1a1313b7fbcef 100644 (file)
@@ -1224,7 +1224,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p,
        NTSTATUS status;
        struct lsa_QuerySecurity r;
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping QuerySecurity test against Samba4\n");
                return True;
        }
@@ -1463,7 +1463,7 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p,
 
        printf("\nTesting lsaRQueryForestTrustInformation\n");
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping QueryForestTrustInformation against Samba4\n");
                return True;
        }
@@ -1830,7 +1830,7 @@ static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
        NTSTATUS status;
        int i;
        BOOL ret = True;
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping QueryDomainInformationPolicy test against Samba4\n");
                return True;
        }
@@ -1866,7 +1866,7 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p,
        BOOL ret = True;
        printf("\nTesting QueryInfoPolicy\n");
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping QueryInfoPolicy against Samba4\n");
                return True;
        }
@@ -1904,7 +1904,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p,
        int i;
        BOOL ret = True;
        printf("\nTesting QueryInfoPolicy2\n");
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping QueryInfoPolicy2 against Samba4\n");
                return True;
        }
index 907772ac8a59a0b535597e9aa8e8a8e7795bfbf8..6352865d987b340113844afdfcec689340da9d8a 100644 (file)
@@ -1226,7 +1226,7 @@ static bool test_GetDomainInfo(struct torture_context *tctx,
 
 static void async_callback(struct rpc_request *req)
 {
-       int *counter = req->async.private_data;
+       int *counter = (int *)req->async.private_data;
        if (NT_STATUS_IS_OK(req->status)) {
                (*counter)++;
        }
@@ -1278,7 +1278,7 @@ static bool test_GetDomainInfo_async(struct torture_context *tctx,
        for (i=0;i<ASYNC_COUNT;i++) {
                creds_client_authenticator(creds, &a);
 
-               creds_async[i] = talloc_memdup(creds, creds, sizeof(*creds));
+               creds_async[i] = (struct creds_CredentialState *)talloc_memdup(creds, creds, sizeof(*creds));
                req[i] = dcerpc_netr_LogonGetDomainInfo_send(p, tctx, &r);
 
                req[i]->async.callback = async_callback;
index 73bb12de87d763ed107f9e81ea5331ad4636ba48..e6f54037bce4440183c06bedebb5c6ddfa41d619 100644 (file)
@@ -1230,7 +1230,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx,
        struct cli_credentials *wks_creds;
 
        status = smbcli_full_connection(mem_ctx, &cli,
-                                       lp_parm_string(-1, "torture", "host"),
+                                       lp_parm_string(NULL, "torture", "host"),
                                        "IPC$", NULL, smb_creds, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
index b149af18597468374bd4bdcdfdda8b357b8314d5..92c4da6321a31d8ddf782160bc77bdae5547b5ec 100644 (file)
@@ -1573,7 +1573,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture)
        u.info21.fields_present = SAMR_FIELD_WORKSTATIONS | SAMR_FIELD_LOGON_HOURS;
        u.info21.workstations.string = TEST_MACHINE_NAME;
        u.info21.logon_hours.units_per_week = 168;
-       u.info21.logon_hours.bits = talloc_zero_size(mem_ctx, 168);
+       u.info21.logon_hours.bits = talloc_zero_array(mem_ctx, uint8_t, 168);
 
        status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_time), mem_ctx, &s);
        if (!NT_STATUS_IS_OK(status)) {
index 757142003ab04da539d19a799a77f4e192dc0c0b..2a70a5b71f150e7fd78c40274cf9e6a5c787c834 100644 (file)
@@ -84,7 +84,7 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        NTSTATUS status;
        struct samr_Shutdown r;
 
-       if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (!lp_parm_bool(NULL, "torture", "dangerous", false)) {
                printf("samr_Shutdown disabled - enable dangerous tests to use\n");
                return True;
        }
@@ -110,7 +110,7 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct lsa_String string;
        struct samr_Password hash;
 
-       if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (!lp_parm_bool(NULL, "torture", "dangerous", false)) {
                printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n");
                return True;
        }
@@ -159,7 +159,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        s.in.sec_info = 7;
        s.in.sdbuf = r.out.sdbuf;
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping SetSecurity test against Samba4\n");
                return True;
        }
@@ -415,7 +415,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_INT(21, logon_hours.bits[3], 21, logon_hours.bits[3], 4, 
                          SAMR_FIELD_LOGON_HOURS);
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping Set Account Flag tests against Samba4\n");
                return ret;
        }
@@ -2121,7 +2121,7 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret = False;
        }
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping MultipleMembers Alias tests against Samba4\n");
                return ret;
        }
@@ -3180,7 +3180,7 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
 #define ASYNC_COUNT 100
        struct rpc_request *req[ASYNC_COUNT];
 
-       if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (!lp_parm_bool(NULL, "torture", "dangerous", false)) {
                printf("samr async test disabled - enable dangerous tests to use\n");
                return True;
        }
@@ -4067,7 +4067,7 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping SetMemberAttributesOfGroup test against Samba4\n");
        } else {
                /* this one is quite strange. I am using random inputs in the
@@ -4256,7 +4256,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
                ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle);
                
-               if (lp_parm_bool(-1, "torture", "samba4", False)) {
+               if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                        printf("skipping GetDisplayEnumerationIndex test against Samba4\n");
                } else {
                        ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
index baf4edca987c5632ae8281d41f7c4a76f980a300..013a6db0bb3f64655e201b4e217663d4d17e3525 100644 (file)
@@ -68,7 +68,7 @@ static NTSTATUS test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                               sizeof(ninfo.challenge));
        if (nt_hash) {
                ninfo.nt.length = 24;
-               ninfo.nt.data = talloc_size(mem_ctx, 24);
+               ninfo.nt.data = talloc_array(mem_ctx, uint8_t, 24);
                SMBOWFencrypt(nt_hash->hash, ninfo.challenge, ninfo.nt.data);
        } else {
                ninfo.nt.length = 0;
@@ -77,7 +77,7 @@ static NTSTATUS test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        
        if (lm_hash) {
                ninfo.lm.length = 24;
-               ninfo.lm.data = talloc_size(mem_ctx, 24);
+               ninfo.lm.data = talloc_array(mem_ctx, uint8_t, 24);
                SMBOWFencrypt(lm_hash->hash, ninfo.challenge, ninfo.lm.data);
        } else {
                ninfo.lm.length = 0;
index 2494fbeffff96f8051e925bb5e5aff4d3b62b450..7d963be1bb7d9f4f41b4ea3115a070078ff63ca3 100644 (file)
@@ -233,7 +233,7 @@ static bool test_schannel(struct torture_context *tctx,
 {
        struct test_join *join_ctx;
        NTSTATUS status;
-       const char *binding = lp_parm_string(-1, "torture", "binding");
+       const char *binding = lp_parm_string(NULL, "torture", "binding");
        struct dcerpc_binding *b;
        struct dcerpc_pipe *p = NULL;
        struct dcerpc_pipe *p_netlogon = NULL;
@@ -435,7 +435,7 @@ bool torture_rpc_schannel2(struct torture_context *torture)
        torture_assert(torture, join_ctx != NULL, 
                       "Failed to join domain with acct_flags=ACB_WSTRUST");
 
-       credentials2 = talloc_memdup(torture, credentials1, sizeof(*credentials1));
+       credentials2 = (struct cli_credentials *)talloc_memdup(torture, credentials1, sizeof(*credentials1));
        credentials1->netlogon_creds = NULL;
        credentials2->netlogon_creds = NULL;
 
index 0e1c2666f8636710fe9d52091ab3b964d66ef973..a976d2fec2a03a3f0e73d5f516957c14720ae5f9 100644 (file)
@@ -145,7 +145,8 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
         struct dcerpc_pipe *p;
        struct policy_handle *handle;
        struct dcerpc_binding *binding;
-       const struct secret_settings *settings = _data;
+       const struct secret_settings *settings = 
+               (const struct secret_settings *)_data;
 
        lp_set_cmdline("ntlmssp client:keyexchange", settings->keyexchange?"True":"False");
        lp_set_cmdline("ntlmssp_client:ntlm2", settings->ntlm2?"True":"False");
index 2f2b4ec485a8f0301ae3614ee415fd0979925ad7..c9006baaf541e87e03f2158c399e7dd97a96f5af 100644 (file)
@@ -80,7 +80,7 @@ static bool test_EnumServicesStatus(struct torture_context *tctx, struct dcerpc_
 
        if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
                r.in.buf_size = *r.out.bytes_needed;
-               r.out.service = talloc_size(tctx, *r.out.bytes_needed);
+               r.out.service = talloc_array(tctx, uint8_t, *r.out.bytes_needed);
                
                status = dcerpc_svcctl_EnumServicesStatusW(p, tctx, &r);
 
index e20699cc04bb773997a112a17f036d786d4a7b12..f32d6832a30bf3efe4a96c579921a5ad5e3f903c 100644 (file)
@@ -126,7 +126,7 @@ struct test_join *torture_create_testuser(struct torture_context *torture,
        int policy_min_pw_len = 0;
        struct test_join *join;
        char *random_pw;
-       const char *dc_binding = lp_parm_string(-1, "torture", "dc_binding");
+       const char *dc_binding = lp_parm_string(NULL, "torture", "dc_binding");
 
        join = talloc(NULL, struct test_join);
        if (join == NULL) {
@@ -327,9 +327,9 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name,
        tj->libnet_r = libnet_r;
                
        libnet_ctx->cred = cmdline_credentials;
-       libnet_r->in.binding = lp_parm_string(-1, "torture", "binding");
+       libnet_r->in.binding = lp_parm_string(NULL, "torture", "binding");
        if (!libnet_r->in.binding) {
-               libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(-1, "torture", "host"));
+               libnet_r->in.binding = talloc_asprintf(libnet_r, "ncacn_np:%s", lp_parm_string(NULL, "torture", "host"));
        }
        libnet_r->in.level = LIBNET_JOINDOMAIN_SPECIFIED;
        libnet_r->in.netbios_name = machine_name;
index fdfc4378ab683fe1e8d18cfc86b02ec44e6cecf1..c9a5732d2a24a98329d4e2102d0f1f611ab7184f 100644 (file)
@@ -74,9 +74,9 @@ static NTSTATUS torture_smb2_write(struct smb2_tree *tree, struct smb2_handle ha
        DATA_BLOB data;
        int i;
        
-       if (lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (lp_parm_bool(NULL, "torture", "dangerous", false)) {
                data = data_blob_talloc(tree, NULL, 160000);
-       } else if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       } else if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                data = data_blob_talloc(tree, NULL, UINT16_MAX);
        } else {
                data = data_blob_talloc(tree, NULL, 120000);
index c5182fb553ce087731b179c38c20b6af56582397..86ca56ba55e86cf968e33a90c3178911b60c2908 100644 (file)
@@ -105,7 +105,7 @@ static BOOL torture_smb2_fileinfo(struct smb2_tree *tree)
                        file_levels[i].dinfo.query_secdesc.in.secinfo_flags = 0x7;
                }
                if (file_levels[i].level == RAW_FILEINFO_SMB2_ALL_EAS) {
-                       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+                       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                                continue;
                        }
                        file_levels[i].finfo.all_eas.in.continue_flags = 
index caa3a5fd52ae87f89666e67cc37b8dc951c4d1d0..8c55813c8c2e244c6c5e38ba3b9f30d45847df33 100644 (file)
@@ -27,6 +27,7 @@
 #include "system/time.h"
 #include "librpc/gen_ndr/ndr_security.h"
 #include "param/param.h"
+#include "torture/smb2/proto.h"
 
 
 /*
@@ -302,8 +303,8 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
 BOOL torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree)
 {
        NTSTATUS status;
-       const char *host = lp_parm_string(-1, "torture", "host");
-       const char *share = lp_parm_string(-1, "torture", "share");
+       const char *host = lp_parm_string(NULL, "torture", "host");
+       const char *share = lp_parm_string(NULL, "torture", "share");
        struct cli_credentials *credentials = cmdline_credentials;
 
        status = smb2_connect(mem_ctx, host, share, credentials, tree, 
index 6a1c2a31f35ad92f0b6f37e1ebadccc714ef42d8..bb28803216686857a37f9be17026c1c61b800841 100644 (file)
@@ -343,25 +343,25 @@ BOOL torture_run_test(struct torture_context *context,
 int torture_setting_int(struct torture_context *test, const char *name, 
                                                        int default_value)
 {
-       return lp_parm_int(-1, "torture", name, default_value);
+       return lp_parm_int(NULL, "torture", name, default_value);
 }
 
 double torture_setting_double(struct torture_context *test, const char *name, 
                                                        double default_value)
 {
-       return lp_parm_double(-1, "torture", name, default_value);
+       return lp_parm_double(NULL, "torture", name, default_value);
 }
 
 bool torture_setting_bool(struct torture_context *test, const char *name, 
                                                        bool default_value)
 {
-       return lp_parm_bool(-1, "torture", name, default_value);
+       return lp_parm_bool(NULL, "torture", name, default_value);
 }
 
 const char *torture_setting_string(struct torture_context *test, const char *name, 
                                                        const char *default_value)
 {
-       const char *ret = lp_parm_string(-1, "torture", name);
+       const char *ret = lp_parm_string(NULL, "torture", name);
 
        if (ret == NULL)
                return default_value;
index 80431f5ac553b437d1a84ab59a311d6639e5c799..aea1ee19e0b4e123561467cd388db9e961e34f04 100644 (file)
@@ -72,8 +72,8 @@ static struct smbcli_state *connect_to_server(void *mem_ctx,
        NTSTATUS status;
        struct smbcli_state *cli;
 
-       const char *host = lp_parm_string(-1, "torture", "host");
-       const char *share = lp_parm_string(-1, "torture", "share");
+       const char *host = lp_parm_string(NULL, "torture", "host");
+       const char *share = lp_parm_string(NULL, "torture", "share");
 
        status = smbcli_full_connection(mem_ctx, &cli,
                                        host, share, NULL,
index 01826dccfc5ff7f8515ff632434e2bac62f3a5a3..8b944e33a09f8eed640194c35673e9ba35bdfd78 100644 (file)
@@ -479,10 +479,10 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       (*c)->transport->options.use_oplocks = lp_parm_bool(-1, "torture", 
-                                                                                                               "use_oplocks", False);
-       (*c)->transport->options.use_level2_oplocks = lp_parm_bool(-1, "torture", 
-                                                                                               "use_level2_oplocks", False);
+       (*c)->transport->options.use_oplocks = lp_parm_bool(NULL, "torture", 
+                                                                                                               "use_oplocks", false);
+       (*c)->transport->options.use_level2_oplocks = lp_parm_bool(NULL, "torture", 
+                                                                                               "use_level2_oplocks", false);
 
        return True;
 }
@@ -495,10 +495,10 @@ _PUBLIC_ bool torture_get_conn_index(int conn_index,
        int num_unc_names = 0;
        const char *p;
 
-       (*host) = talloc_strdup(mem_ctx, lp_parm_string(-1, "torture", "host"));
-       (*share) = talloc_strdup(mem_ctx, lp_parm_string(-1, "torture", "share"));
+       (*host) = talloc_strdup(mem_ctx, lp_parm_string(NULL, "torture", "host"));
+       (*share) = talloc_strdup(mem_ctx, lp_parm_string(NULL, "torture", "share"));
        
-       p = lp_parm_string(-1, "torture", "unclist");
+       p = lp_parm_string(NULL, "torture", "unclist");
        if (!p) {
                return True;
        }
index e0ebe48d638f8a9f5e1bf541e50f8587c90e0e5e..08d4ecb1a7e25e8c98279294f37101e67dc62b9b 100644 (file)
@@ -151,8 +151,9 @@ static int do_global_checks(void)
        ret = do_global_checks();
 
        for (s=0;s<lp_numservices();s++) {
-               if (lp_snum_ok(s))
-                       if (strlen(lp_servicename(s)) > 12) {
+               struct service *service = lp_servicebynum(s);
+               if (service != NULL)
+                       if (strlen(lp_servicename(lp_servicebynum(s))) > 12) {
                                fprintf(stderr, "WARNING: You have some share names that are longer than 12 characters.\n" );
                                fprintf(stderr, "These may not be accessible to some older clients.\n" );
                                fprintf(stderr, "(Eg. Windows9x, WindowsMe, and not listed in smbclient in Samba 3.0.)\n" );
@@ -161,9 +162,10 @@ static int do_global_checks(void)
        }
 
        for (s=0;s<lp_numservices();s++) {
-               if (lp_snum_ok(s)) {
-                       const char **deny_list = lp_hostsdeny(s);
-                       const char **allow_list = lp_hostsallow(s);
+               struct service *service = lp_servicebynum(s);
+               if (service != NULL) {
+                       const char **deny_list = lp_hostsdeny(service);
+                       const char **allow_list = lp_hostsallow(service);
                        int i;
                        if(deny_list) {
                                for (i=0; deny_list[i]; i++) {
@@ -171,7 +173,7 @@ static int do_global_checks(void)
                                        char *hasquery = strchr_m(deny_list[i], '?');
                                        if(hasstar || hasquery) {
                                                fprintf(stderr,"Invalid character %c in hosts deny list (%s) for service %s.\n",
-                                                          hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(s) );
+                                                          hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(service) );
                                        }
                                }
                        }
@@ -182,7 +184,7 @@ static int do_global_checks(void)
                                        char *hasquery = strchr_m(allow_list[i], '?');
                                        if(hasstar || hasquery) {
                                                fprintf(stderr,"Invalid character %c in hosts allow list (%s) for service %s.\n",
-                                                          hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(s) );
+                                                          hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(service) );
                                        }
                                }
                        }
@@ -197,24 +199,20 @@ static int do_global_checks(void)
                        getc(stdin);
                }
                if (section_name || parameter_name) {
-                       BOOL isGlobal = False;
+                       struct service *service = NULL;
                        if (!section_name) {
                                section_name = GLOBAL_NAME;
-                               isGlobal = True;
-                       } else if ((isGlobal=!strwicmp(section_name, GLOBAL_NAME)) == 0 &&
-                                (s=lp_servicenumber(section_name)) == -1) {
+                               service = NULL;
+                       } else if ((!strwicmp(section_name, GLOBAL_NAME)) == 0 &&
+                                (service=lp_service(section_name)) == NULL) {
                                        fprintf(stderr,"Unknown section %s\n",
                                                section_name);
                                        return(1);
                        }
                        if (!parameter_name) {
-                               if (isGlobal == True) {
-                                       lp_dump(stdout, show_defaults, 0);
-                               } else {
-                                       lp_dump_one(stdout, show_defaults, s);
-                               }
+                               lp_dump_one(stdout, show_defaults, service);
                        } else {
-                               ret = !lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
+                               ret = !lp_dump_a_parameter(s, parameter_name, stdout, (service == NULL));
                        }
                } else {
                        lp_dump(stdout, show_defaults, lp_numservices());
@@ -225,14 +223,15 @@ static int do_global_checks(void)
        if(cname && caddr){
                /* this is totally ugly, a real `quick' hack */
                for (s=0;s<lp_numservices();s++) {
-                       if (lp_snum_ok(s)) {
-                               if (allow_access(NULL, lp_hostsdeny(-1), lp_hostsallow(-1), cname, caddr)
-                                   && allow_access(NULL, lp_hostsdeny(s), lp_hostsallow(s), cname, caddr)) {
+                       struct service *service = lp_servicebynum(s);
+                       if (service != NULL) {
+                               if (allow_access(NULL, lp_hostsdeny(NULL), lp_hostsallow(NULL), cname, caddr)
+                                   && allow_access(NULL, lp_hostsdeny(service), lp_hostsallow(service), cname, caddr)) {
                                        fprintf(stderr,"Allow connection from %s (%s) to %s\n",
-                                                  cname,caddr,lp_servicename(s));
+                                                  cname,caddr,lp_servicename(service));
                                } else {
                                        fprintf(stderr,"Deny connection from %s (%s) to %s\n",
-                                                  cname,caddr,lp_servicename(s));
+                                                  cname,caddr,lp_servicename(service));
                                }
                        }
                }
index 985f1c040866b9fb7d9add1f095219fb4a194934..fb103f16c5d10bfc4600c60eb9df9dbb6cf6ac36 100644 (file)
@@ -152,7 +152,7 @@ static int http_readFile(EspHandle handle,
        fd = open(path, O_RDONLY);
        if (fd == -1 || fstat(fd, &st) != 0 || !S_ISREG(st.st_mode)) goto failed;
 
-       *buf = talloc_size(handle, st.st_size+1);
+       *buf = talloc_array(handle, char, st.st_size+1);
        if (*buf == NULL) goto failed;
 
        if (read(fd, *buf, st.st_size) != st.st_size) goto failed;
@@ -808,7 +808,7 @@ static void http_setup_session(struct esp_state *esp)
                s->data = NULL;
                s->te = NULL;
                s->edata = edata;
-               s->lifetime = lp_parm_int(-1, "web", "sessiontimeout", 900);
+               s->lifetime = lp_parm_int(NULL, "web", "sessiontimeout", 900);
                DLIST_ADD(edata->sessions, s);
                talloc_set_destructor(s, session_destructor);
                if (!generated_key) {
index efad8b6512cbabe4da5fa246906db7a0ec49e474..221c792f14fe2aca3e172f0d9122bbf604435fbe 100644 (file)
@@ -85,7 +85,7 @@ static void websrv_recv(struct stream_connection *conn, uint16_t flags)
        /* parse any lines that are available */
        b = web->input.partial;
        while (!web->input.end_of_headers &&
-              (p=memchr(b.data, '\n', b.length))) {
+              (p=(uint8_t *)memchr(b.data, '\n', b.length))) {
                const char *line = (const char *)b.data;
                *p = 0;
                if (p != b.data && p[-1] == '\r') {
index 6ac7fed0ccf11d454e9efc4c27f5f0ddb1cc0b57..503034cac1b10f45f728c20609fe8192282cc23d 100644 (file)
@@ -82,26 +82,26 @@ static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service)
        }
 
        /* the default renew interval is 6 days */
-       service->config.renew_interval    = lp_parm_int(-1,"wreplsrv","renew_interval", 6*24*60*60);
+       service->config.renew_interval    = lp_parm_int(NULL,"wreplsrv","renew_interval", 6*24*60*60);
 
        /* the default tombstone (extinction) interval is 6 days */
-       service->config.tombstone_interval= lp_parm_int(-1,"wreplsrv","tombstone_interval", 6*24*60*60);
+       service->config.tombstone_interval= lp_parm_int(NULL,"wreplsrv","tombstone_interval", 6*24*60*60);
 
        /* the default tombstone (extinction) timeout is 1 day */
-       service->config.tombstone_timeout = lp_parm_int(-1,"wreplsrv","tombstone_timeout", 1*24*60*60);
+       service->config.tombstone_timeout = lp_parm_int(NULL,"wreplsrv","tombstone_timeout", 1*24*60*60);
 
        /* the default tombstone extra timeout is 3 days */
-       service->config.tombstone_extra_timeout = lp_parm_int(-1,"wreplsrv","tombstone_extra_timeout", 3*24*60*60);
+       service->config.tombstone_extra_timeout = lp_parm_int(NULL,"wreplsrv","tombstone_extra_timeout", 3*24*60*60);
 
        /* the default verify interval is 24 days */
-       service->config.verify_interval   = lp_parm_int(-1,"wreplsrv","verify_interval", 24*24*60*60);
+       service->config.verify_interval   = lp_parm_int(NULL,"wreplsrv","verify_interval", 24*24*60*60);
 
        /* the default scavenging interval is 'renew_interval/2' */
-       service->config.scavenging_interval=lp_parm_int(-1,"wreplsrv","scavenging_interval",
+       service->config.scavenging_interval=lp_parm_int(NULL,"wreplsrv","scavenging_interval",
                                                        service->config.renew_interval/2);
 
        /* the maximun interval to the next periodic processing event */
-       service->config.periodic_interval = lp_parm_int(-1,"wreplsrv","periodic_interval", 15);
+       service->config.periodic_interval = lp_parm_int(NULL,"wreplsrv","periodic_interval", 15);
 
        return NT_STATUS_OK;
 }