r26270: Require specifying the loadparm_context or NULL to cli_credentials_guess().
authorJelmer Vernooij <jelmer@samba.org>
Mon, 3 Dec 2007 22:33:09 +0000 (23:33 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:50 +0000 (05:47 +0100)
(This used to be commit e52710d6794a25ba697f8c26b43784226964f9cb)

12 files changed:
source4/auth/credentials/credentials.c
source4/auth/credentials/credentials.i
source4/auth/credentials/credentials_wrap.c
source4/cluster/ctdb/ctdb_cluster.h
source4/dsdb/samdb/ldb_modules/proxy.c
source4/lib/cmdline/popt_credentials.c
source4/librpc/rpc/dcerpc_connect.c
source4/librpc/rpc/dcerpc_wrap.c
source4/scripting/ejs/smbcalls_rpc.c
source4/torture/gentest.c
source4/torture/locktest.c
source4/torture/masktest.c

index 0c5f5b0f3bbe79eae7bcfd07e22a4a5a359b2d77..1889731781fb9c6c6d3f940b0c0938825a5ee188 100644 (file)
@@ -635,11 +635,14 @@ void cli_credentials_set_conf(struct cli_credentials *cred,
  * 
  * @param cred Credentials structure to fill in
  */
-void cli_credentials_guess(struct cli_credentials *cred)
+void cli_credentials_guess(struct cli_credentials *cred,
+                          struct loadparm_context *lp_ctx)
 {
        char *p;
 
-       cli_credentials_set_conf(cred, global_loadparm);
+       if (lp_ctx != NULL) {
+               cli_credentials_set_conf(cred, global_loadparm);
+       }
        
        if (getenv("LOGNAME")) {
                cli_credentials_set_username(cred, getenv("LOGNAME"), CRED_GUESS_ENV);
index e694f933513c9eca7c249f4718f8c6482f26a922..565221c466ad736671dc1a0ec452043d294bf5c1 100644 (file)
@@ -85,7 +85,7 @@ typedef struct cli_credentials {
         bool set_workstation(const char *workstation, 
                              enum credentials_obtained obtained=CRED_SPECIFIED);
 
-        void guess(void);
+        void guess(struct loadparm_context *lp_ctx = NULL);
         bool is_anonymous(void);
 
         const struct samr_Password *get_nt_hash(TALLOC_CTX *mem_ctx);
index c238f18ede4b2a375e00e757019ebc0e53a65b60..fc3826d35c255d9ce263676231e7dd1ecbd80688 100644 (file)
@@ -2459,8 +2459,9 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_TALLOC_CTX swig_types[0]
 #define SWIGTYPE_p_char swig_types[1]
 #define SWIGTYPE_p_cli_credentials swig_types[2]
-static swig_type_info *swig_types[4];
-static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0};
+#define SWIGTYPE_p_loadparm_context swig_types[3]
+static swig_type_info *swig_types[5];
+static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -3351,17 +3352,21 @@ fail:
 SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   cli_credentials *arg1 = (cli_credentials *) 0 ;
+  struct loadparm_context *arg2 = (struct loadparm_context *) NULL ;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
   char *  kwnames[] = {
-    (char *) "self", NULL 
+    (char *) "self",(char *) "lp_ctx", NULL 
   };
   
   {
     arg1 = NULL;
   }
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_guess",kwnames,&obj0)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_guess",kwnames,&obj0,&obj1)) SWIG_fail;
   if (obj0) {
     res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
@@ -3369,7 +3374,14 @@ SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyO
     }
     arg1 = (cli_credentials *)(argp1);
   }
-  cli_credentials_guess(arg1);
+  if (obj1) {
+    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_guess" "', argument " "2"" of type '" "struct loadparm_context *""'"); 
+    }
+    arg2 = (struct loadparm_context *)(argp2);
+  }
+  cli_credentials_guess(arg1,arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -3548,21 +3560,25 @@ static PyMethodDef SwigMethods[] = {
 static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
   &_swigt__p_TALLOC_CTX,
   &_swigt__p_char,
   &_swigt__p_cli_credentials,
+  &_swigt__p_loadparm_context,
 };
 
 static swig_cast_info _swigc__p_TALLOC_CTX[] = {  {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_cli_credentials[] = {  {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_loadparm_context[] = {  {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_TALLOC_CTX,
   _swigc__p_char,
   _swigc__p_cli_credentials,
+  _swigc__p_loadparm_context,
 };
 
 
index dac728d034c430d143ed95e168553d47b21de6ae..bac09bd6f36144dded2be894b059974fe811a9b2 100644 (file)
@@ -19,4 +19,5 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-void cluster_ctdb_init(struct event_context *ev, const char *model);
+void cluster_ctdb_init(struct loadparm_context *lp_ctx,
+                      struct event_context *ev, const char *model);
index d50d971e2a2c0907b228b6f6df77ef0c19c7b987..435422ae17152e524b490485074c1bac2351d5ee 100644 (file)
@@ -129,7 +129,7 @@ static int load_proxy_info(struct ldb_module *module)
                ldb_oom(module->ldb);
                goto failed;
        }
-       cli_credentials_guess(creds);
+       cli_credentials_guess(creds, NULL);
        cli_credentials_set_username(creds, username, CRED_SPECIFIED);
        cli_credentials_set_password(creds, password, CRED_SPECIFIED);
 
index 53e214ab221b8d693d82b29a6e71820217fbc586..d82cdc510096152a14b7281efae377960243d503 100644 (file)
@@ -60,7 +60,7 @@ static void popt_common_credentials_callback(poptContext con,
        }
        
        if (reason == POPT_CALLBACK_REASON_POST) {
-               cli_credentials_guess(cmdline_credentials);
+               cli_credentials_guess(cmdline_credentials, NULL);
 
                if (!dont_ask) {
                        cli_credentials_set_cmdline_callbacks(cmdline_credentials);
index 21f726c293689baa03729055860b7f909d2f92cb..d19dac9fe57a45bc4ddad312fe97c42c8f69f829 100644 (file)
@@ -230,8 +230,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(TALLOC_C
                s->io.creds = cli_credentials_init(mem_ctx);
                if (composite_nomem(s->io.creds, c)) return c;
 
-               cli_credentials_set_anonymous(s->io.creds);
-               cli_credentials_guess(s->io.creds);
+               cli_credentials_guess(s->io.creds, NULL);
        }
 
        /* send smb2 connect request */
index f230e40dd2741b009759aece4d24a3eead7167e6..48dd3b30a87852ce53ed969636a9ca6dc5591d55 100644 (file)
@@ -2461,10 +2461,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_char swig_types[2]
 #define SWIGTYPE_p_cli_credentials swig_types[3]
 #define SWIGTYPE_p_dcerpc_pipe swig_types[4]
-#define SWIGTYPE_p_p_dcerpc_pipe swig_types[5]
-#define SWIGTYPE_p_uint32_t swig_types[6]
-static swig_type_info *swig_types[8];
-static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
+#define SWIGTYPE_p_loadparm_context swig_types[5]
+#define SWIGTYPE_p_p_dcerpc_pipe swig_types[6]
+#define SWIGTYPE_p_uint32_t swig_types[7]
+static swig_type_info *swig_types[9];
+static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -3371,17 +3372,21 @@ fail:
 SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   cli_credentials *arg1 = (cli_credentials *) 0 ;
+  struct loadparm_context *arg2 = (struct loadparm_context *) NULL ;
   void *argp1 = 0 ;
   int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
   char *  kwnames[] = {
-    (char *) "self", NULL 
+    (char *) "self",(char *) "lp_ctx", NULL 
   };
   
   {
     arg1 = NULL;
   }
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_guess",kwnames,&obj0)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_guess",kwnames,&obj0,&obj1)) SWIG_fail;
   if (obj0) {
     res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
@@ -3389,7 +3394,14 @@ SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyO
     }
     arg1 = (cli_credentials *)(argp1);
   }
-  cli_credentials_guess(arg1);
+  if (obj1) {
+    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_guess" "', argument " "2"" of type '" "struct loadparm_context *""'"); 
+    }
+    arg2 = (struct loadparm_context *)(argp2);
+  }
+  cli_credentials_guess(arg1,arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -3678,6 +3690,7 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_dcerpc_pipe = {"_p_dcerpc_pipe", "struct dcerpc_pipe *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_dcerpc_pipe = {"_p_p_dcerpc_pipe", "struct dcerpc_pipe **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
 
@@ -3687,6 +3700,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_char,
   &_swigt__p_cli_credentials,
   &_swigt__p_dcerpc_pipe,
+  &_swigt__p_loadparm_context,
   &_swigt__p_p_dcerpc_pipe,
   &_swigt__p_uint32_t,
 };
@@ -3696,6 +3710,7 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = {  {&_swigt__p_TALLOC_CTX, 0, 0,
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_cli_credentials[] = {  {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_dcerpc_pipe[] = {  {&_swigt__p_dcerpc_pipe, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_loadparm_context[] = {  {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_dcerpc_pipe[] = {  {&_swigt__p_p_dcerpc_pipe, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
 
@@ -3705,6 +3720,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_char,
   _swigc__p_cli_credentials,
   _swigc__p_dcerpc_pipe,
+  _swigc__p_loadparm_context,
   _swigc__p_p_dcerpc_pipe,
   _swigc__p_uint32_t,
 };
index 5d7c6742089de69c744be9cbdbc505f52e0eb5f5..049494cba636e00e8e84a8b107ac654ed3a6fe30 100644 (file)
@@ -153,7 +153,6 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
        }
        if (creds == NULL) {
                creds = cli_credentials_init(mprMemCtx());
-               cli_credentials_guess(creds);
                cli_credentials_set_anonymous(creds);
        }
 
index 132cfd61343b94953c0725b0fcc32cfbb4dccdf1..fa352a3e9e0ff6d29f09365ac1cabe64ad96eda1 100644 (file)
@@ -2200,8 +2200,8 @@ static bool split_unc_name(const char *unc, char **server, char **share)
 
        servers[0].credentials = cli_credentials_init(talloc_autofree_context());
        servers[1].credentials = cli_credentials_init(talloc_autofree_context());
-       cli_credentials_guess(servers[0].credentials);
-       cli_credentials_guess(servers[1].credentials);
+       cli_credentials_guess(servers[0].credentials, global_loadparm);
+       cli_credentials_guess(servers[1].credentials, global_loadparm);
 
        options.seed = time(NULL);
        options.numops = 1000;
index 810a21cb9e6b0cf74405b8f93430bd9a5a2321af..7d111be12b2495f3b12d8087cf871695cf7b48ba 100644 (file)
@@ -565,8 +565,8 @@ static void usage(void)
 
        servers[0] = cli_credentials_init(talloc_autofree_context());
        servers[1] = cli_credentials_init(talloc_autofree_context());
-       cli_credentials_guess(servers[0]);
-       cli_credentials_guess(servers[1]);
+       cli_credentials_guess(servers[0], global_loadparm);
+       cli_credentials_guess(servers[1], global_loadparm);
 
        seed = time(NULL);
 
index 9f47a6839fe6eda9603f861a522aef40737a56c9..2b3c92db0cd7c303f8809ef9909959500ad2242f 100644 (file)
@@ -305,7 +305,7 @@ static void usage(void)
        lp_load(dyn_CONFIGFILE);
 
        credentials = cli_credentials_init(talloc_autofree_context());
-       cli_credentials_guess(credentials);
+       cli_credentials_guess(credentials, global_loadparm);
 
        seed = time(NULL);