[PATCH] 2 fixes for 2.2.2
Gerald (Jerry) Carter
jerry at samba.org
Thu Oct 18 09:12:05 GMT 2001
Here is a patch to correct two problems in 2.2.2
* %U and %G could not be used in services names
in smb.conf
* %G would fail to be expanded in an "include = ..."
line
This has already been applied to SAMBA_2_2 cvs
cheers, jerry
---------------------------------------------------------------------
www.samba.org SAMBA Team jerry_at_samba.org
www.plainjoe.org jerry_at_plainjoe.org
--"I never saved anything for the swim back." Ethan Hawk in Gattaca--
-------------- next part --------------
--- /opt/src/samba-2.2.2/source/lib/substitute.c Thu Jul 5 21:01:34 2001
+++ lib/substitute.c Wed Oct 17 23:45:41 2001
@@ -170,6 +170,7 @@
{
char *p, *s;
fstring pidstr;
+ struct passwd *pass;
for (s=str; (p=strchr(s, '%'));s=p) {
fstring tmp_str;
@@ -182,6 +183,13 @@
strlower(tmp_str);
string_sub(p,"%U",tmp_str,l);
break;
+ case 'G' :
+ if ((pass = Get_Pwnam(current_user_info.smb_name, False))!=NULL) {
+ string_sub(p,"%G",gidtoname(pass->pw_gid),l);
+ } else {
+ p += 2;
+ }
+ break;
case 'D' :
fstrcpy(tmp_str, current_user_info.domain);
strupper(tmp_str);
@@ -218,19 +226,11 @@
void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, char *str)
{
char *p, *s, *home;
- struct passwd *pass;
for (s=str; (p=strchr(s, '%'));s=p) {
int l = sizeof(pstring) - (int)(p-str);
switch (*(p+1)) {
- case 'G' :
- if ((pass = Get_Pwnam(user,False))!=NULL) {
- string_sub(p,"%G",gidtoname(pass->pw_gid),l);
- } else {
- p += 2;
- }
- break;
case 'N' : string_sub(p,"%N", automount_server(user),l); break;
case 'H':
if ((home = get_user_home_dir(user))) {
--- /opt/src/samba-2.2.2/source/param/loadparm.c Sat Oct 13 16:09:31 2001
+++ param/loadparm.c Wed Oct 17 14:54:16 2001
@@ -73,6 +73,7 @@
extern pstring global_myname;
pstring global_scope = "";
+
#ifndef GLOBAL_NAME
#define GLOBAL_NAME "global"
#endif
@@ -1792,6 +1793,7 @@
tservice = *pservice;
/* it might already exist */
+
if (name)
{
i = getservicebyname(name, NULL);
@@ -3430,16 +3432,26 @@
int lp_servicenumber(char *pszServiceName)
{
int iService;
+ fstring serviceName;
+
for (iService = iNumServices - 1; iService >= 0; iService--)
- if (VALID(iService) && ServicePtrs[iService]->szService &&
- strequal(ServicePtrs[iService]->szService, pszServiceName))
- break;
+ {
+ if (VALID(iService) && ServicePtrs[iService]->szService)
+ {
+ /*
+ * The substitution here is used to support %U is
+ * service names
+ */
+ fstrcpy(serviceName, ServicePtrs[iService]->szService);
+ standard_sub_basic(serviceName);
+ if (strequal(serviceName, pszServiceName))
+ break;
+ }
+ }
if (iService < 0)
- DEBUG(7,
- ("lp_servicenumber: couldn't find %s\n",
- pszServiceName));
+ DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
return (iService);
}
More information about the samba
mailing list