[Samba] uploading printer driver using APW changes printer share name

2007-12-08 Thread Marcus Sobchak [EMAIL PROTECTED]
Hi,

I've set up a printer called UREW-EDV using the cups webinterface.
After that an enumprinters give the following output:

rpcclient $ enumprintershp LaserJet 1320 PCL 6
 flags:[0x80]
 name:[\\server\UREW-EDV]
 description:[\\server\UREW-EDV,,Netzwerkdrucker-EDV]
 comment:[Netzwerkdrucker-EDV]

Next step is uploading a driver using APW:

http://samba.org/samba/docs/man/Samba-HOWTO-Collection/classicalprinting.html#id388469

This works fine, but afterwards the name of the printer is changed to
the name _of the driver_ (in this case from UREW-EDV to hp LaserJet
1320 PCL 6):

rpcclient $ enumprinters
 flags:[0x80]
 name:[\\server\hp LaserJet 1320 PCL 6] - ???
 description:[\\server\hp LaserJet 1320 PCL 6,hp LaserJet 1320 PCL
6,Netzwerkdrucker-EDV]
 comment:[Netzwerkdrucker-EDV]

Now the printer is shown as hp LaserJet 1320 PCL 6 under \\server -
Printer and Faxes. Why that? To correct this I have to open the
printer properties and set the name back to UREW-EDV manually. Without
this correction the PrintandPoint feature for this printer doesn't work.
It took me a hole night to figure this out. Is this a normal behaviour
or is this my mistake?

System info:

  samba3.0.24-6etch8
  samba-common 3.0.24-6etch8
  cupsys   1.2.7-4etch1 
  cupsys-bsd   1.2.7-4etch1 
  cupsys-client1.2.7-4etch1 
  cupsys-common1.2.7-4etch1 
  libcupsimage21.2.7-4etch1 
  libcupsys2   1.2.7-4etch1

[global]
.
load printers = yes
printing = cups
printcap name = cups

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
public = no
writable = no
create mode = 0700

[print$]
comment = Drucker Treiber
path = /var/lib/samba/printers
browseable = yes
read only = yes 
guest ok = no   
write list = root

Thanks,
Marcus


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


[Samba] vscan + clamAV Ubuntu\Debian

2007-12-08 Thread Trent Murray
Hi all,

Does anyone know of a pre-built .deb to get vscan-clamav up and running
under Ubuntu.  If not, has anyone had any luck with alien to covert the rpm
packages that are avalible.

Sorry for the trouble however I have just spent days building a server and I
dont want to have to manually compile samba.

Cheers!


Trent Murray
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba


[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-552-g01a5c3e

2007-12-08 Thread Jeremy Allison
The branch, v3-2-test has been updated
   via  01a5c3ea4bf18d99ca1c35e8c38367046e4c867b (commit)
   via  60500fac30911500eade7c2a9aa13569dcab0911 (commit)
  from  ea8633689d43cc2fe15aedb430b4cac38fa73d14 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 01a5c3ea4bf18d99ca1c35e8c38367046e4c867b
Author: Volker Lendecke [EMAIL PROTECTED]
Date:   Sat Dec 8 11:21:08 2007 +0100

Fix C++ warnings

commit 60500fac30911500eade7c2a9aa13569dcab0911
Author: Volker Lendecke [EMAIL PROTECTED]
Date:   Sat Dec 8 11:20:53 2007 +0100

Fix two incompatible pointer warnings

Jeremy, please check

---

Summary of changes:
 source/auth/pampass.c |2 +-
 source/client/client.c|2 +-
 source/libsmb/clidfs.c|2 +-
 source/libsmb/clifile.c   |   18 +-
 source/libsmb/clilist.c   |2 +-
 source/libsmb/clirap.c|8 
 source/nmbd/nmbd_winsserver.c |2 +-
 7 files changed, 18 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/auth/pampass.c b/source/auth/pampass.c
index 554df3c..58921bd 100644
--- a/source/auth/pampass.c
+++ b/source/auth/pampass.c
@@ -238,7 +238,7 @@ static struct chat_struct *make_pw_chat(const char *p)
strlower_m(t-prompt);
trim_char(t-prompt, ' ', ' ');
 
-   if (!next_token_talloc(frame, p, reply, NULL)) {
+   if (!next_token_talloc(frame, p, reply, NULL)) {
break;
}
 
diff --git a/source/client/client.c b/source/client/client.c
index bbe5572..1e2f96c 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -4060,7 +4060,7 @@ static char **remote_completion(const char *text, int len)
info.samelen = info.len = len-i-1;
 
if (i  0) {
-   info.dirmask = SMB_MALLOC(i+2);
+   info.dirmask = SMB_MALLOC_ARRAY(char, i+2);
if (!info.dirmask) {
goto cleanup;
}
diff --git a/source/libsmb/clidfs.c b/source/libsmb/clidfs.c
index f124821..e0c40b5 100644
--- a/source/libsmb/clidfs.c
+++ b/source/libsmb/clidfs.c
@@ -592,7 +592,7 @@ bool cli_dfs_get_referral(TALLOC_CTX *ctx,
*num_refs = 0;
*refs = NULL;
 
-   param = SMB_MALLOC(2+pathlen+2);
+   param = SMB_MALLOC_ARRAY(char, 2+pathlen+2);
if (!param) {
return false;
}
diff --git a/source/libsmb/clifile.c b/source/libsmb/clifile.c
index 70b4fe7..001a42d 100644
--- a/source/libsmb/clifile.c
+++ b/source/libsmb/clifile.c
@@ -37,8 +37,8 @@ static bool cli_link_internal(struct cli_state *cli, const 
char *oldname, const
size_t oldlen = 2*(strlen(oldname)+1);
size_t newlen = 2*(strlen(newname)+1);
 
-   param = SMB_MALLOC(6+newlen+2);
-   data = SMB_MALLOC(oldlen+2);
+   param = SMB_MALLOC_ARRAY(char, 6+newlen+2);
+   data = SMB_MALLOC_ARRAY(char, oldlen+2);
if (!param || !data) {
return false;
}
@@ -191,7 +191,7 @@ bool cli_unix_getfacl(struct cli_state *cli, const char 
*name, size_t *prb_size,
char *rparam=NULL, *rdata=NULL;
char *p;
 
-   param = SMB_MALLOC(6+nlen+2);
+   param = SMB_MALLOC_ARRAY(char, 6+nlen+2);
if (!param) {
return false;
}
@@ -251,7 +251,7 @@ bool cli_unix_stat(struct cli_state *cli, const char *name, 
SMB_STRUCT_STAT *sbu
 
ZERO_STRUCTP(sbuf);
 
-   param = SMB_MALLOC(6+nlen+2);
+   param = SMB_MALLOC_ARRAY(char, 6+nlen+2);
if (!param) {
return false;
}
@@ -352,7 +352,7 @@ static bool cli_unix_chmod_chown_internal(struct cli_state 
*cli, const char *fna
char *rparam=NULL, *rdata=NULL;
char *p;
 
-   param = SMB_MALLOC(6+nlen+2);
+   param = SMB_MALLOC_ARRAY(char, 6+nlen+2);
if (!param) {
return false;
}
@@ -1662,7 +1662,7 @@ bool cli_set_ea_path(struct cli_state *cli, const char 
*path, const char *ea_nam
char *p;
bool ret;
 
-   param = SMB_MALLOC(6+srclen+2);
+   param = SMB_MALLOC_ARRAY(char, 6+srclen+2);
if (!param) {
return false;
}
@@ -1835,7 +1835,7 @@ bool cli_get_ea_list_path(struct cli_state *cli, const 
char *path,
size_t srclen = 2*(strlen(path)+1);
bool ret;
 
-   param = SMB_MALLOC(6+srclen+2);
+   param = SMB_MALLOC_ARRAY(char, 6+srclen+2);
if (!param) {
return false;
}
@@ -1940,7 +1940,7 @@ static int cli_posix_open_internal(struct cli_state *cli, 
const char *fname, int
uint32 wire_flags = open_flags_to_wire(flags);
size_t srclen = 2*(strlen(fname)+1);
 
-   param = SMB_MALLOC(6+srclen+2);
+   param = SMB_MALLOC_ARRAY(char, 

svn commit: samba r26339 - in branches/SAMBA_4_0: . source/client source/lib/cmdline source/param source/scripting/ejs source/torture source/utils

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:31:41 + (Sat, 08 Dec 2007)
New Revision: 26339

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26339

Log:
Make loadparm talloc-allocated.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/client/smbmount.c
   branches/SAMBA_4_0/source/client/smbspool.c
   branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_config.c
   branches/SAMBA_4_0/source/scripting/ejs/smbscript.c
   branches/SAMBA_4_0/source/torture/gentest.c
   branches/SAMBA_4_0/source/torture/locktest.c
   branches/SAMBA_4_0/source/torture/locktest2.c
   branches/SAMBA_4_0/source/torture/masktest.c
   branches/SAMBA_4_0/source/utils/testparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/client/smbmount.c
===
--- branches/SAMBA_4_0/source/client/smbmount.c 2007-12-07 23:56:53 UTC (rev 
26338)
+++ branches/SAMBA_4_0/source/client/smbmount.c 2007-12-08 23:31:41 UTC (rev 
26339)
@@ -897,7 +897,7 @@
pstrcpy(username,getenv(LOGNAME));
}
 
-   if (!lp_load(dyn_CONFIGFILE, lp_ctx)) {
+   if (!lp_load(talloc_autofree_context(), dyn_CONFIGFILE, lp_ctx)) {
fprintf(stderr, Can't load %s - run testparm to debug it\n, 
lp_config_file());
}

Modified: branches/SAMBA_4_0/source/client/smbspool.c
===
--- branches/SAMBA_4_0/source/client/smbspool.c 2007-12-07 23:56:53 UTC (rev 
26338)
+++ branches/SAMBA_4_0/source/client/smbspool.c 2007-12-08 23:31:41 UTC (rev 
26339)
@@ -177,7 +177,7 @@
 
   setup_logging(argv[0], DEBUG_STDOUT);
 
-  if (!lp_load(dyn_CONFIGFILE, lp_ctx)) {
+  if (!lp_load(talloc_autofree_context(), dyn_CONFIGFILE, lp_ctx)) {
  fprintf(stderr, ERROR: Can't load %s - run testparm to debug it\n, 
lp_config_file());
  return (1);
   }

Modified: branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
===
--- branches/SAMBA_4_0/source/lib/cmdline/popt_common.c 2007-12-07 23:56:53 UTC 
(rev 26338)
+++ branches/SAMBA_4_0/source/lib/cmdline/popt_common.c 2007-12-08 23:31:41 UTC 
(rev 26339)
@@ -64,9 +64,9 @@
if (reason == POPT_CALLBACK_REASON_POST) {
if (!lp_loaded()) {
if (getenv(SMB_CONF_PATH))
-   lp_load(getenv(SMB_CONF_PATH), NULL);
+   lp_load(talloc_autofree_context(), 
getenv(SMB_CONF_PATH), NULL);
else
-   lp_load(dyn_CONFIGFILE, NULL);
+   lp_load(talloc_autofree_context(), 
dyn_CONFIGFILE, NULL);
}
/* Hook any 'every Samba program must do this, after
 * the smb.conf is setup' functions here */
@@ -120,7 +120,7 @@
 
case 's':
if (arg) {
-   lp_load(arg, NULL);
+   lp_load(talloc_autofree_context(), arg, NULL);
}
break;
 

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-07 23:56:53 UTC (rev 
26338)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:41 UTC (rev 
26339)
@@ -259,7 +259,7 @@
 };
 
 /* local variables */
-static struct loadparm_context {
+struct loadparm_context {
struct loadparm_global Globals;
struct loadparm_service **ServicePtrs;
int iNumServices;
@@ -271,9 +271,9 @@
char *subfname;
time_t modtime;
} *file_lists;
-} loadparm;
+};
 
-struct loadparm_context *global_loadparm = loadparm;
+struct loadparm_context *global_loadparm = NULL;
 
 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
 
@@ -1087,7 +1087,7 @@
lp_ctx-iNumServices++;
} 
 
-   lp_ctx-ServicePtrs[i] = init_service(talloc_autofree_context());
+   lp_ctx-ServicePtrs[i] = init_service(lp_ctx);
if (lp_ctx-ServicePtrs[i] == NULL) {
DEBUG(0,(lp_add_service: out of memory!\n));
return NULL;
@@ -1246,11 +1246,12 @@
if (service == NULL) {
if (parm-class == P_LOCAL)
return ((char *)sDefault)+parm-offset;
-   else
-   return ((char *)lp_ctx-Globals)+parm-offset;
+   else if (parm-class == P_GLOBAL)
+   return ((char *)(lp_ctx-Globals))+parm-offset;
+   else return NULL;
+   } else {
+

svn commit: samba r26340 - in branches/SAMBA_4_0: . source/param

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:31:49 + (Sat, 08 Dec 2007)
New Revision: 26340

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26340

Log:
Add special handlers for debuglevel and logfile.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:41 UTC (rev 
26339)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:49 UTC (rev 
26340)
@@ -282,6 +282,10 @@
   const char *pszParmValue, char **ptr);
 static bool handle_copy(struct loadparm_context *lp_ctx, 
const char *pszParmValue, char **ptr);
+static bool handle_debuglevel(struct loadparm_context *lp_ctx,
+ const char *pszParmValue, char **ptr);
+static bool handle_logfile(struct loadparm_context *lp_ctx,
+  const char *pszParmValue, char **ptr);
 
 static const struct enum_list enum_protocol[] = {
{PROTOCOL_SMB2, SMB2},
@@ -434,9 +438,9 @@
{hosts allow, P_LIST, P_LOCAL, LOCAL_VAR(szHostsallow), NULL, NULL, 
FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | 
FLAG_DEVELOPER},
{hosts deny, P_LIST, P_LOCAL, LOCAL_VAR(szHostsdeny), NULL, NULL, 
FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | 
FLAG_DEVELOPER},
 
-   {log level, P_INTEGER, P_GLOBAL, GLOBAL_VAR(debuglevel), NULL, NULL, 
FLAG_ADVANCED | FLAG_DEVELOPER},
-   {debuglevel, P_INTEGER, P_GLOBAL, GLOBAL_VAR(debuglevel), NULL, NULL, 
FLAG_HIDE},
-   {log file, P_STRING, P_GLOBAL, GLOBAL_VAR(logfile), NULL, NULL, 
FLAG_ADVANCED | FLAG_DEVELOPER},
+   {log level, P_INTEGER, P_GLOBAL, GLOBAL_VAR(debuglevel), 
handle_debuglevel, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+   {debuglevel, P_INTEGER, P_GLOBAL, GLOBAL_VAR(debuglevel), 
handle_debuglevel, NULL, FLAG_HIDE},
+   {log file, P_STRING, P_GLOBAL, GLOBAL_VAR(logfile), handle_logfile, 
NULL, FLAG_ADVANCED | FLAG_DEVELOPER},

{smb ports, P_LIST, P_GLOBAL, GLOBAL_VAR(smb_ports), NULL, NULL, 
FLAG_ADVANCED | FLAG_DEVELOPER},
{nbt port, P_INTEGER, P_GLOBAL, GLOBAL_VAR(nbt_port), NULL, NULL, 
FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -1072,7 +1076,7 @@
if (i == lp_ctx-iNumServices) {
struct loadparm_service **tsp;

-   tsp = realloc_p(lp_ctx-ServicePtrs, struct loadparm_service *, 
+   tsp = talloc_realloc(lp_ctx, lp_ctx-ServicePtrs, struct 
loadparm_service *, 
num_to_alloc);
   
if (!tsp) {
@@ -1527,6 +1531,21 @@
return bRetval;
 }
 
+static bool handle_debuglevel(struct loadparm_context *lp_ctx, 
+   const char *pszParmValue, char **ptr)
+{
+   DEBUGLEVEL = atoi(pszParmValue);
+
+   return true;
+}
+
+static bool handle_logfile(struct loadparm_context *lp_ctx, 
+   const char *pszParmValue, char **ptr)
+{
+   logfile = pszParmValue;
+   return true;
+}
+
 /***
  Initialise a copymap.
 ***/
@@ -2281,10 +2300,8 @@
 parm_table[i].type == P_USTRING) 
parm_table[i].offset != -1 
!(parm_table[i].flags  FLAG_CMDLINE)) {
-   string_set(lp_ctx, 
-  (char **)(
-  (char *)((parm_table[i].class == 
P_LOCAL)?sDefault:(lp_ctx-Globals)) +
-  parm_table[i].offset), );
+   char **r = ((char *)(parm_table[i].class == 
P_LOCAL)?sDefault:(lp_ctx-Globals)) + parm_table[i].offset;
+   *r = talloc_strdup(lp_ctx, );
}
}
 
@@ -2477,8 +2494,6 @@
lp_do_global_parameter(lp_ctx, wins server, 127.0.0.1);
}
 
-   DEBUGLEVEL = lp_ctx-Globals.debuglevel;
-   logfile = lp_ctx-Globals.logfile;
panic_action = lp_ctx-Globals.panic_action;
 
reload_charcnv();



svn commit: samba r26341 - in branches/SAMBA_4_0: .

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:31:52 + (Sat, 08 Dec 2007)
New Revision: 26341

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26341

Log:
Cope with API changes.
Modified:
   branches/SAMBA_4_0/


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...



svn commit: samba r26342 - in branches/SAMBA_4_0: . source/param

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:31:55 + (Sat, 08 Dec 2007)
New Revision: 26342

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26342

Log:
Fix initialization.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:52 UTC (rev 
26341)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:55 UTC (rev 
26342)
@@ -260,7 +260,7 @@
 
 /* local variables */
 struct loadparm_context {
-   struct loadparm_global Globals;
+   struct loadparm_global *globals;
struct loadparm_service **ServicePtrs;
int iNumServices;
struct loadparm_service *currentService;
@@ -623,19 +623,19 @@
 */
 
 #define FN_GLOBAL_STRING(fn_name,var_name) \
- const char *fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) 
return NULL; return lp_ctx-Globals.var_name ? 
lp_string(lp_ctx-Globals.var_name) : ;}
+ const char *fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) 
return NULL; return lp_ctx-globals-var_name ? 
lp_string(lp_ctx-globals-var_name) : ;}
 #define FN_GLOBAL_CONST_STRING(fn_name,var_name) \
- const char *fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) 
return NULL; return lp_ctx-Globals.var_name ? lp_ctx-Globals.var_name : ;}
+ const char *fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) 
return NULL; return lp_ctx-globals-var_name ? lp_ctx-globals-var_name : ;}
 #define FN_GLOBAL_LIST(fn_name,var_name) \
- const char **fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) 
return NULL; return lp_ctx-Globals.var_name;}
+ const char **fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) 
return NULL; return lp_ctx-globals-var_name;}
 #define FN_GLOBAL_BOOL(fn_name,var_name) \
- bool fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return 
false; return lp_ctx-Globals.var_name;}
+ bool fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return 
false; return lp_ctx-globals-var_name;}
 #if 0 /* unused */
 #define FN_GLOBAL_CHAR(fn_name,ptr) \
  char fn_name(void) {return(*(char *)(ptr));}
 #endif
 #define FN_GLOBAL_INTEGER(fn_name,var_name) \
- int fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return 0; 
return lp_ctx-Globals.var_name;}
+ int fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return 0; 
return lp_ctx-globals-var_name;}
 
 #define FN_LOCAL_STRING(fn_name,val) \
  const char *fn_name(struct loadparm_service *service) 
{return(lp_string((const char *)((service != NULL  service-val != NULL) ? 
service-val : sDefault.val)));}
@@ -790,7 +790,7 @@
char *vfskey;
 struct param_opt *data;

-   data = (service == NULL ? lp_ctx-Globals.param_opt : 
service-param_opt);
+   data = (service == NULL ? lp_ctx-globals-param_opt : 
service-param_opt);
 
asprintf(vfskey, %s:%s, type, option);
strlower(vfskey);
@@ -805,8 +805,8 @@
 
if (service != NULL) {
/* Try to fetch the same option but from globals */
-   /* but only if we are not already working with Globals */
-   for (data = lp_ctx-Globals.param_opt; data; 
+   /* but only if we are not already working with globals */
+   for (data = lp_ctx-globals-param_opt; data; 
 data = data-next) {
if (strcmp(data-key, vfskey) == 0) {
free(vfskey);
@@ -1153,7 +1153,7 @@
string_set(service, service-szPath, tmpdir());
 
service-comment = talloc_asprintf(service, %s Service (%s), 
-   fstype, lp_ctx-Globals.szServerString);
+   fstype, lp_ctx-globals-szServerString);
string_set(service, service-fstype, fstype);
service-iMaxConnections = -1;
service-bAvailable = true;
@@ -1251,7 +1251,7 @@
if (parm-class == P_LOCAL)
return ((char *)sDefault)+parm-offset;
else if (parm-class == P_GLOBAL)
-   return ((char *)(lp_ctx-Globals))+parm-offset;
+   return ((char *)lp_ctx-globals)+parm-offset;
else return NULL;
} else {
return ((char *)service) + parm-offset;
@@ -1587,8 +1587,8 @@
strlower(name);
 
if (service == NULL) {
-   data = lp_ctx-Globals.param_opt;
-   mem_ctx = lp_ctx;
+   data = lp_ctx-globals-param_opt;
+   mem_ctx = lp_ctx-globals;
} else {
data = service-param_opt;
  

svn commit: samba r26349 - in branches/SAMBA_4_0: . source/param source/param/tests

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:23 + (Sat, 08 Dec 2007)
New Revision: 26349

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26349

Log:
More tests.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/param/tests/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:18 UTC (rev 
26348)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:23 UTC (rev 
26349)
@@ -1187,10 +1187,10 @@
return true;
 }
 
-/***
- Map a parameter's string representation to something we can use. 
- Returns False if the parameter string is not recognised, else TRUE.
-***/
+/**
+ * Map a parameter's string representation to something we can use. 
+ * Returns False if the parameter string is not recognised, else TRUE.
+ */
 
 static int map_parameter(const char *pszParmName)
 {
@@ -1213,7 +1213,7 @@
 }
 
 
-/*
+/**
   return the parameter structure for a parameter
 */
 struct parm_struct *lp_parm_struct(const char *name)
@@ -1223,7 +1223,7 @@
return parm_table[parmnum];
 }
 
-/*
+/**
   return the parameter pointer for a parameter
 */
 void *lp_parm_ptr(struct loadparm_context *lp_ctx,
@@ -1348,11 +1348,10 @@
}
 }
 
-/***
-Check a service for consistency. Return False if the service is in any way
-incomplete or faulty, else True.
-***/
-
+/**
+ * Check a service for consistency. Return False if the service is in any way
+ * incomplete or faulty, else True.
+ */
 static bool service_ok(struct loadparm_service *service)
 {
bool bRetval;
@@ -1429,7 +1428,6 @@
 /***
  Check if a config file has changed date.
 /
-
 bool lp_file_list_changed(struct loadparm_context *lp_ctx)
 {
struct file_lists *f;

Modified: branches/SAMBA_4_0/source/param/tests/loadparm.c
===
--- branches/SAMBA_4_0/source/param/tests/loadparm.c2007-12-08 23:32:18 UTC 
(rev 26348)
+++ branches/SAMBA_4_0/source/param/tests/loadparm.c2007-12-08 23:32:23 UTC 
(rev 26349)
@@ -97,6 +97,17 @@
return true;
 }
 
+static bool test_lp_do_service_parameter(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   struct loadparm_service *service = lp_add_service(lp_ctx, sDefault, 
foo);
+   torture_assert(tctx, lp_do_service_parameter(lp_ctx, service, 
+some:thing, foo), 
lp_set_option failed);
+   torture_assert_str_equal(tctx, lp_parm_string(lp_ctx, service, some, 
thing), foo,
+invalid parametric option);
+   return true;
+}
+
 struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx)
 {
struct torture_suite *suite = torture_suite_create(mem_ctx, LOADPARM);
@@ -109,6 +120,7 @@
torture_suite_add_simple_test(suite, set_lp_parm_bool, 
test_lp_parm_bool);
torture_suite_add_simple_test(suite, set_lp_parm_int, 
test_lp_parm_int);
torture_suite_add_simple_test(suite, set_lp_parm_bytes, 
test_lp_parm_bytes);
+   torture_suite_add_simple_test(suite, service_parameter, 
test_lp_do_service_parameter);
 
return suite;
 }



svn commit: samba r26350 - in branches/SAMBA_4_0: . source/lib/cmdline source/param source/param/tests source/smb_server/smb

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:27 + (Sat, 08 Dec 2007)
New Revision: 26350

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26350

Log:
More tests.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/param/tests/loadparm.c
   branches/SAMBA_4_0/source/smb_server/smb/signing.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
===
--- branches/SAMBA_4_0/source/lib/cmdline/popt_common.c 2007-12-08 23:32:23 UTC 
(rev 26349)
+++ branches/SAMBA_4_0/source/lib/cmdline/popt_common.c 2007-12-08 23:32:27 UTC 
(rev 26350)
@@ -62,11 +62,11 @@
struct loadparm_context *lp_ctx = global_loadparm; /* FIXME: allow 
overriding */
 
if (reason == POPT_CALLBACK_REASON_POST) {
-   if (!lp_loaded()) {
+   if (lp_ctx == NULL) {
if (getenv(SMB_CONF_PATH))
-   lp_load(talloc_autofree_context(), 
getenv(SMB_CONF_PATH), NULL);
+   lp_load(talloc_autofree_context(), 
getenv(SMB_CONF_PATH), lp_ctx);
else
-   lp_load(talloc_autofree_context(), 
dyn_CONFIGFILE, NULL);
+   lp_load(talloc_autofree_context(), 
dyn_CONFIGFILE, lp_ctx);
}
/* Hook any 'every Samba program must do this, after
 * the smb.conf is setup' functions here */

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:23 UTC (rev 
26349)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:27 UTC (rev 
26350)
@@ -2198,25 +2198,16 @@
 }
 
 
-/***
- Auto-load some home services.
-***/
-
+/**
+ * Auto-load some home services.
+ */
 static void lp_add_auto_services(struct loadparm_context *lp_ctx, 
 const char *str)
 {
return;
 }
 
-/***
- Have we loaded a services file yet?
-***/
 
-bool lp_loaded(void)
-{
-   return (global_loadparm != NULL);
-}
-
 /***
  Unload unused services.
 ***/
@@ -2255,9 +2246,9 @@
return 0;
 }
 
-/***
- Initialise the global parameter structure.
-***/
+/**
+ * Initialise the global parameter structure.
+ */
 struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 {
int i;
@@ -2423,10 +2414,11 @@
return lp_ctx;
 }
 
-/***
- Load the services array from the services file. Return True on success, 
- False on failure.
-***/
+/**
+ * Load the services array from the services file. 
+ *
+ * Return True on success, False on failure.
+ */
 bool lp_load(TALLOC_CTX *mem_ctx, const char *filename, struct 
loadparm_context **ret_lp)
 {
char *n2;
@@ -2481,18 +2473,18 @@
return bRetval;
 }
 
-/***
- Return the max number of services.
-***/
+/**
+ * Return the max number of services.
+ */
 
 int lp_numservices(struct loadparm_context *lp_ctx)
 {
return lp_ctx-iNumServices;
 }
 
-/***
-Display the contents of the services array in human-readable form.
-***/
+/**
+ * Display the contents of the services array in human-readable form.
+ */
 
 void lp_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults, 
 int maxtoprint)
@@ -2510,10 +2502,9 @@
lp_dump_one(f, show_defaults, lp_ctx-services[iService]);
 }
 
-/***
-Display the contents of one service in human-readable form.
-***/
-
+/**
+ * 

svn commit: samba r26351 - in branches/SAMBA_4_0: . source/param

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:33 + (Sat, 08 Dec 2007)
New Revision: 26351

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26351

Log:
Fix handling of flags when there are multiple loadparm contexts around.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/param/loadparm.h


Changeset:
Sorry, the patch is too large (816 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26351


svn commit: samba r26352 - in branches/SAMBA_4_0: . source/client source/lib/cmdline source/param source/scripting/ejs source/scripting/libjs source/torture source/utils

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:37 + (Sat, 08 Dec 2007)
New Revision: 26352

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26352

Log:
Don't make lp_load create a new context.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/client/smbmount.c
   branches/SAMBA_4_0/source/client/smbspool.c
   branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_config.c
   branches/SAMBA_4_0/source/scripting/ejs/smbscript.c
   branches/SAMBA_4_0/source/scripting/libjs/provision.js
   branches/SAMBA_4_0/source/scripting/libjs/upgrade.js
   branches/SAMBA_4_0/source/torture/gentest.c
   branches/SAMBA_4_0/source/torture/locktest.c
   branches/SAMBA_4_0/source/torture/locktest2.c
   branches/SAMBA_4_0/source/torture/masktest.c
   branches/SAMBA_4_0/source/utils/testparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/client/smbmount.c
===
--- branches/SAMBA_4_0/source/client/smbmount.c 2007-12-08 23:32:33 UTC (rev 
26351)
+++ branches/SAMBA_4_0/source/client/smbmount.c 2007-12-08 23:32:37 UTC (rev 
26352)
@@ -897,7 +897,9 @@
pstrcpy(username,getenv(LOGNAME));
}
 
-   if (!lp_load(talloc_autofree_context(), dyn_CONFIGFILE, lp_ctx)) {
+   lp_ctx = global_loadparm = loadparm_init(talloc_autofree_context());
+
+   if (!lp_load(lp_ctx, dyn_CONFIGFILE)) {
fprintf(stderr, Can't load %s - run testparm to debug it\n, 
lp_config_file());
}
@@ -923,6 +925,6 @@
}
strupper(my_netbios_name);
 
-   init_mount(global_loadparm);
+   init_mount(lp_ctx);
return 0;
 }

Modified: branches/SAMBA_4_0/source/client/smbspool.c
===
--- branches/SAMBA_4_0/source/client/smbspool.c 2007-12-08 23:32:33 UTC (rev 
26351)
+++ branches/SAMBA_4_0/source/client/smbspool.c 2007-12-08 23:32:37 UTC (rev 
26352)
@@ -177,7 +177,9 @@
 
   setup_logging(argv[0], DEBUG_STDOUT);
 
-  if (!lp_load(talloc_autofree_context(), dyn_CONFIGFILE, lp_ctx)) {
+  global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
+
+  if (!lp_load(lp_ctx, dyn_CONFIGFILE)) {
  fprintf(stderr, ERROR: Can't load %s - run testparm to debug it\n, 
lp_config_file());
  return (1);
   }

Modified: branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
===
--- branches/SAMBA_4_0/source/lib/cmdline/popt_common.c 2007-12-08 23:32:33 UTC 
(rev 26351)
+++ branches/SAMBA_4_0/source/lib/cmdline/popt_common.c 2007-12-08 23:32:37 UTC 
(rev 26352)
@@ -40,6 +40,7 @@
 enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR};
 
 struct cli_credentials *cmdline_credentials = NULL;
+struct loadparm_context *cmdline_lp_ctx = NULL;
 
 static void popt_version_callback(poptContext con,
   enum poptCallbackReason reason,
@@ -59,14 +60,13 @@
   const char *arg, const void *data)
 {
const char *pname;
-   struct loadparm_context *lp_ctx = global_loadparm; /* FIXME: allow 
overriding */
 
if (reason == POPT_CALLBACK_REASON_POST) {
-   if (lp_ctx == NULL) {
+   if (lp_configfile(cmdline_lp_ctx) == NULL) {
if (getenv(SMB_CONF_PATH))
-   lp_load(talloc_autofree_context(), 
getenv(SMB_CONF_PATH), lp_ctx);
+   lp_load(cmdline_lp_ctx, 
getenv(SMB_CONF_PATH));
else
-   lp_load(talloc_autofree_context(), 
dyn_CONFIGFILE, lp_ctx);
+   lp_load(cmdline_lp_ctx, dyn_CONFIGFILE);
}
/* Hook any 'every Samba program must do this, after
 * the smb.conf is setup' functions here */
@@ -82,6 +82,11 @@
pname++;
 
if (reason == POPT_CALLBACK_REASON_PRE) {
+   if (global_loadparm != NULL) {
+   cmdline_lp_ctx = global_loadparm;
+   } else {
+   cmdline_lp_ctx = global_loadparm = 
loadparm_init(talloc_autofree_context());
+   }
 
/* Hook for 'almost the first thing to do in a samba program' 
here */
/* setup for panics */
@@ -104,14 +109,14 @@
break;
 
case OPT_OPTION:
-   if (!lp_set_option(lp_ctx, arg)) {
+   if (!lp_set_option(cmdline_lp_ctx, arg)) {
fprintf(stderr, Error setting option '%s'\n, arg);
exit(1);
}
  

svn commit: samba r26347 - in branches/SAMBA_4_0: . source/param source/param/tests source/selftest/env source/smb_server

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:13 + (Sat, 08 Dec 2007)
New Revision: 26347

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26347

Log:
More tests.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/param/tests/loadparm.c
   branches/SAMBA_4_0/source/selftest/env/Samba4.pm
   branches/SAMBA_4_0/source/smb_server/smb_server.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:file-ids
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:09 UTC (rev 
26346)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:13 UTC (rev 
26347)
@@ -554,20 +554,6 @@
return parm_table;
 }
 
-static TALLOC_CTX *lp_talloc;
-
-/*** a
- Free up temporary memory - called from the main loop.
-/
-
-void lp_talloc_free(void)
-{
-   if (!lp_talloc)
-   return;
-   talloc_free(lp_talloc);
-   lp_talloc = NULL;
-}
-
 /***
  Convenience routine to grab string parameters into temporary memory
  and run standard_sub_basic on them. The buffers can be written to by
@@ -975,7 +961,7 @@
 {
const char *value = lp_get_parametric(lp_ctx, service, type, option);

-   if (value)
+   if (value != NULL)
return lp_double(value);
 
return default_v;
@@ -990,7 +976,7 @@
 {
const char *value = lp_get_parametric(lp_ctx, service, type, option);

-   if (value)
+   if (value != NULL)
return lp_bool(value);
 
return default_v;

Modified: branches/SAMBA_4_0/source/param/tests/loadparm.c
===
--- branches/SAMBA_4_0/source/param/tests/loadparm.c2007-12-08 23:32:09 UTC 
(rev 26346)
+++ branches/SAMBA_4_0/source/param/tests/loadparm.c2007-12-08 23:32:13 UTC 
(rev 26347)
@@ -53,6 +53,50 @@
return true;
 }
 
+static bool test_lp_parm_double(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_set_option(lp_ctx, some:thing=3.4), 
lp_set_option failed);
+   torture_assert(tctx, lp_parm_double(lp_ctx, NULL, some, thing, 2.0) 
== 3.4, 
+invalid parametric option);
+   torture_assert(tctx, lp_parm_double(lp_ctx, NULL, some, bla, 2.0) 
== 2.0, 
+invalid parametric option);
+   return true;
+}
+
+static bool test_lp_parm_bool(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_set_option(lp_ctx, some:thing=true), 
lp_set_option failed);
+   torture_assert(tctx, lp_parm_bool(lp_ctx, NULL, some, thing, false) 
== true, 
+invalid parametric option);
+   torture_assert(tctx, lp_parm_bool(lp_ctx, NULL, some, bla, true) == 
true, 
+invalid parametric option);
+   return true;
+}
+
+static bool test_lp_parm_int(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_set_option(lp_ctx, some:thing=34), 
lp_set_option failed);
+   torture_assert_int_equal(tctx, lp_parm_int(lp_ctx, NULL, some, 
thing, 20), 34, 
+invalid parametric option);
+   torture_assert_int_equal(tctx, lp_parm_int(lp_ctx, NULL, some, bla, 
42), 42, 
+invalid parametric option);
+   return true;
+}
+
+static bool test_lp_parm_bytes(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_set_option(lp_ctx, some:thing=16K), 
lp_set_option failed);
+   torture_assert_int_equal(tctx, lp_parm_bytes(lp_ctx, NULL, some, 
thing, 20), 16 * 1024, 
+invalid parametric option);
+   torture_assert_int_equal(tctx, lp_parm_bytes(lp_ctx, NULL, some, 
bla, 42), 42, 
+invalid parametric option);
+   return true;
+}
+
 struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx)
 {
struct torture_suite *suite = torture_suite_create(mem_ctx, LOADPARM);
@@ -61,6 +105,10 @@
torture_suite_add_simple_test(suite, set_option, test_set_option);
torture_suite_add_simple_test(suite, set_option_invalid, 
test_set_option_invalid);
torture_suite_add_simple_test(suite, set_option_parametric, 

svn commit: samba r26344 - in branches/SAMBA_4_0: . source/param source/utils

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:01 + (Sat, 08 Dec 2007)
New Revision: 26344

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26344

Log:
Fix memory access.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/utils/testparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:58 UTC (rev 
26343)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:01 UTC (rev 
26344)
@@ -259,7 +259,7 @@
 /* local variables */
 struct loadparm_context {
struct loadparm_global *globals;
-   struct loadparm_service **ServicePtrs;
+   struct loadparm_service **services;
int iNumServices;
struct loadparm_service *currentService;
bool bInGlobalSection;
@@ -1067,37 +1067,35 @@
 
/* find an invalid one */
for (i = 0; i  lp_ctx-iNumServices; i++)
-   if (lp_ctx-ServicePtrs[i] == NULL)
+   if (lp_ctx-services[i] == NULL)
break;
 
/* if not, then create one */
if (i == lp_ctx-iNumServices) {
struct loadparm_service **tsp;

-   tsp = talloc_realloc(lp_ctx, lp_ctx-ServicePtrs, struct 
loadparm_service *, 
-   num_to_alloc);
+   tsp = talloc_realloc(lp_ctx, lp_ctx-services, struct 
loadparm_service *, num_to_alloc);
   
if (!tsp) {
-   DEBUG(0,(lp_add_service: failed to enlarge 
ServicePtrs!\n));
+   DEBUG(0,(lp_add_service: failed to enlarge 
services!\n));
return NULL;
+   } else {
+   lp_ctx-services = tsp;
+   lp_ctx-services[lp_ctx-iNumServices] = NULL;
}
-   else {
-   lp_ctx-ServicePtrs = tsp;
-   lp_ctx-ServicePtrs[lp_ctx-iNumServices] = NULL;
-   }
 
lp_ctx-iNumServices++;
} 
 
-   lp_ctx-ServicePtrs[i] = init_service(lp_ctx);
-   if (lp_ctx-ServicePtrs[i] == NULL) {
+   lp_ctx-services[i] = init_service(lp_ctx-services);
+   if (lp_ctx-services[i] == NULL) {
DEBUG(0,(lp_add_service: out of memory!\n));
return NULL;
}
-   copy_service(lp_ctx-ServicePtrs[i], tservice, NULL);
+   copy_service(lp_ctx-services[i], tservice, NULL);
if (name != NULL)
-   string_set(lp_ctx-ServicePtrs[i], 
lp_ctx-ServicePtrs[i]-szService, name);
-   return lp_ctx-ServicePtrs[i];
+   string_set(lp_ctx-services[i], 
lp_ctx-services[i]-szService, name);
+   return lp_ctx-services[i];
 }
 
 /***
@@ -1192,7 +1190,7 @@
/* the printer name is set to the service name. */
string_set(service, service-szPrintername, pszPrintername);
string_set(service, service-comment, comment);
-   service-bBrowseable = sDefault.bBrowseable;
+   service-bBrowseable = default_service-bBrowseable;
/* Printers cannot be read_only. */
service-bRead_only = false;
/* Printer services must be printable. */
@@ -1266,9 +1264,9 @@
int iService;
 
for (iService = lp_ctx-iNumServices - 1; iService = 0; iService--)
-   if (lp_ctx-ServicePtrs[iService] != NULL 
-   strwicmp(lp_ctx-ServicePtrs[iService]-szService, 
pszServiceName) == 0) {
-   return lp_ctx-ServicePtrs[iService];
+   if (lp_ctx-services[iService] != NULL 
+   strwicmp(lp_ctx-services[iService]-szService, 
pszServiceName) == 0) {
+   return lp_ctx-services[iService];
}
 
return NULL;
@@ -2079,7 +2077,8 @@
 Display the contents of the global structure.
 ***/
 
-static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, bool 
show_defaults)
+static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, 
+bool show_defaults)
 {
int i;
struct param_opt *data;
@@ -2146,10 +2145,10 @@
 }
 }
 
-bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, int snum, const char 
*parm_name, FILE * f, 
-bool isGlobal)
+bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, 
+struct loadparm_service *service, 
+const char *parm_name, FILE * f, bool isGlobal)
 {
-   

svn commit: samba r26345 - in branches/SAMBA_4_0: . source/param

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:05 + (Sat, 08 Dec 2007)
New Revision: 26345

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26345

Log:
Fix dumping an individual parameter.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:01 UTC (rev 
26344)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:32:05 UTC (rev 
26345)
@@ -2147,7 +2147,7 @@
 
 bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, 
 struct loadparm_service *service, 
-const char *parm_name, FILE * f, bool isGlobal)
+const char *parm_name, FILE * f)
 {
struct parm_struct *parm;
void *ptr;
@@ -2157,10 +2157,7 @@
return false;
}
 
-   if (isGlobal)
-   ptr = ((char *)sDefault) + parm-offset;
-   else
-   ptr = ((char *)service) + parm-offset;
+   ptr = lp_parm_ptr(lp_ctx, service,parm);

print_parameter(parm, ptr, f);
fprintf(f, \n);



svn commit: samba r26343 - in branches/SAMBA_4_0: . source/param

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:31:58 + (Sat, 08 Dec 2007)
New Revision: 26343

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26343

Log:
Remove bLoaded global variable.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===
--- branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:55 UTC (rev 
26342)
+++ branches/SAMBA_4_0/source/param/loadparm.c  2007-12-08 23:31:58 UTC (rev 
26343)
@@ -64,8 +64,6 @@
 #include param/param.h
 #include param/loadparm.h
 
-static bool bLoaded = false;
-
 #define standard_sub_basic talloc_strdup
 
 static bool do_parameter(const char *, const char *, void *);
@@ -2236,7 +2234,7 @@
 
 bool lp_loaded(void)
 {
-   return bLoaded;
+   return (global_loadparm != NULL);
 }
 
 /***
@@ -2489,8 +2487,6 @@
lp_add_hidden(lp_ctx, IPC$, IPC);
lp_add_hidden(lp_ctx, ADMIN$, DISK);
 
-   bLoaded = true;
-
if (!lp_ctx-globals-szWINSservers  lp_ctx-globals-bWINSsupport) {
lp_do_global_parameter(lp_ctx, wins server, 127.0.0.1);
}



Build status as of Sun Dec 9 00:00:02 2007

2007-12-08 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2007-12-08 
00:00:44.0 +
+++ /home/build/master/cache/broken_results.txt 2007-12-09 00:01:08.0 
+
@@ -1,25 +1,25 @@
-Build status as of Sat Dec  8 00:00:01 2007
+Build status as of Sun Dec  9 00:00:02 2007
 
 Build counts:
 Tree Total  Broken Panic 
 SOC  0  0  0 
 build_farm   0  0  0 
-ccache   28 9  0 
+ccache   27 9  0 
 ctdb 0  0  0 
 distcc   1  0  0 
-ldb  28 12 0 
-libreplace   27 10 0 
-lorikeet-heimdal 24 14 0 
+ldb  27 11 0 
+libreplace   26 10 0 
+lorikeet-heimdal 23 13 0 
 pidl 18 5  0 
-ppp  11 8  0 
+ppp  10 8  0 
 python   0  0  0 
-rsync28 12 0 
+rsync27 12 0 
 samba-docs   0  0  0 
 samba-gtk4  4  0 
-samba4   25 24 0 
+samba4   25 22 0 
 samba_3_20  0  0 
-samba_3_2_test 27 18 0 
-smb-build27 26 0 
-talloc   28 8  0 
-tdb  28 5  0 
+samba_3_2_test 26 18 0 
+smb-build26 25 0 
+talloc   27 7  0 
+tdb  27 5  0 
 


svn commit: samba r26346 - in branches/SAMBA_4_0: . source/param/tests source/torture/local

2007-12-08 Thread jelmer
Author: jelmer
Date: 2007-12-08 23:32:09 + (Sat, 08 Dec 2007)
New Revision: 26346

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=26346

Log:
Add tests for loadparm.
Added:
   branches/SAMBA_4_0/source/param/tests/loadparm.c
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/torture/local/config.mk
   branches/SAMBA_4_0/source/torture/local/local.c


Changeset:

Property changes on: branches/SAMBA_4_0
___
Name: bzr:revision-info
...skipped...
Name: bzr:file-ids
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Added: branches/SAMBA_4_0/source/param/tests/loadparm.c
===
--- branches/SAMBA_4_0/source/param/tests/loadparm.c2007-12-08 23:32:05 UTC 
(rev 26345)
+++ branches/SAMBA_4_0/source/param/tests/loadparm.c2007-12-08 23:32:09 UTC 
(rev 26346)
@@ -0,0 +1,66 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Jelmer Vernooij [EMAIL PROTECTED] 2007
+   
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see http://www.gnu.org/licenses/.
+*/
+
+#include includes.h
+#include param/share.h
+#include param/param.h
+#include torture/torture.h
+
+static bool test_create(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_ctx != NULL, lp_ctx);
+   return true;
+}
+
+static bool test_set_option(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_set_option(lp_ctx, workgroup=werkgroep), 
lp_set_option failed);
+   torture_assert_str_equal(tctx, WERKGROEP, lp_workgroup(lp_ctx), 
workgroup);
+   return true;
+}
+
+static bool test_set_option_invalid(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, !lp_set_option(lp_ctx, workgroup), 
lp_set_option succeeded);
+   return true;
+}
+
+static bool test_set_option_parametric(struct torture_context *tctx)
+{
+   struct loadparm_context *lp_ctx = loadparm_init(tctx);
+   torture_assert(tctx, lp_set_option(lp_ctx, some:thing=blaat), 
lp_set_option failed);
+   torture_assert_str_equal(tctx, lp_parm_string(lp_ctx, NULL, some, 
thing), blaat, 
+invalid parametric option);
+   return true;
+}
+
+struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx)
+{
+   struct torture_suite *suite = torture_suite_create(mem_ctx, LOADPARM);
+
+   torture_suite_add_simple_test(suite, create, test_create);
+   torture_suite_add_simple_test(suite, set_option, test_set_option);
+   torture_suite_add_simple_test(suite, set_option_invalid, 
test_set_option_invalid);
+   torture_suite_add_simple_test(suite, set_option_parametric, 
test_set_option_parametric);
+
+   return suite;
+}

Modified: branches/SAMBA_4_0/source/torture/local/config.mk
===
--- branches/SAMBA_4_0/source/torture/local/config.mk   2007-12-08 23:32:05 UTC 
(rev 26345)
+++ branches/SAMBA_4_0/source/torture/local/config.mk   2007-12-08 23:32:09 UTC 
(rev 26346)
@@ -28,6 +28,7 @@
../../lib/tdr/testsuite.o \
../../lib/events/testsuite.o \
../../param/tests/share.o \
+   ../../param/tests/loadparm.o \
../../auth/credentials/tests/simple.o \
local.o \
dbspeed.o \

Modified: branches/SAMBA_4_0/source/torture/local/local.c
===
--- branches/SAMBA_4_0/source/torture/local/local.c 2007-12-08 23:32:05 UTC 
(rev 26345)
+++ branches/SAMBA_4_0/source/torture/local/local.c 2007-12-08 23:32:09 UTC 
(rev 26346)
@@ -47,6 +47,7 @@
torture_local_ndr, 
torture_local_tdr, 
torture_local_share,
+   torture_local_loadparm,
torture_local_charset,
torture_local_compression,
torture_local_event,