svn commit: samba r22065 - in branches: SAMBA_3_0/source/smbd
SAMBA_3_0_25/source/smbd
jra at samba.org
jra at samba.org
Wed Apr 4 00:03:14 GMT 2007
Author: jra
Date: 2007-04-04 00:03:12 +0000 (Wed, 04 Apr 2007)
New Revision: 22065
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22065
Log:
First logic change I've found :-(. We were being too
restrictive about strings being NULL. If an info level
doesn't use a subformat the subformat string may be
missing (null). Add debug statements to help track
this.
Jeremy
Modified:
branches/SAMBA_3_0/source/smbd/lanman.c
branches/SAMBA_3_0_25/source/smbd/lanman.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/lanman.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/lanman.c 2007-04-03 22:59:55 UTC (rev 22064)
+++ branches/SAMBA_3_0/source/smbd/lanman.c 2007-04-04 00:03:12 UTC (rev 22065)
@@ -441,12 +441,18 @@
desc->subformat = "z";
break;
default:
+ DEBUG(0,("check_printq_info: invalid level %d\n",
+ uLevel ));
return False;
}
- if (strcmp(desc->format,id1) != 0) {
+ if (id1 == NULL || strcmp(desc->format,id1) != 0) {
+ DEBUG(0,("check_printq_info: invalid format %s\n",
+ id1 ? id1 : "<NULL>" ));
return False;
}
- if (desc->subformat && strcmp(desc->subformat,id2) != 0) {
+ if (desc->subformat && (id2 == NULL || strcmp(desc->subformat,id2) != 0)) {
+ DEBUG(0,("check_printq_info: invalid subformat %s\n",
+ id2 ? id2 : "<NULL>" ));
return False;
}
return True;
@@ -802,9 +808,7 @@
}
uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
str3 = get_safe_str_ptr(param,tpscnt,p,4);
- if (!str3) {
- return False;
- }
+ /* str3 may be null here and is checked in check_printq_info(). */
/* remove any trailing username */
if ((p = strchr_m(QueueName,'%')))
@@ -917,7 +921,7 @@
int *subcntarr = NULL;
int queuecnt = 0, subcnt = 0, succnt = 0;
- if (!param_format || !output_format1 || !p || !output_format2) {
+ if (!param_format || !output_format1 || !p) {
return False;
}
@@ -2683,9 +2687,16 @@
case 2: desc->format = "WWzWWDDzz"; break;
case 3: desc->format = "WWzWWDDzzzzzzzzzzlz"; break;
case 4: desc->format = "WWzWWDDzzzzzDDDDDDD"; break;
- default: return False;
+ default:
+ DEBUG(0,("check_printjob_info: invalid level %d\n",
+ uLevel ));
+ return False;
}
- if (strcmp(desc->format,id) != 0) return False;
+ if (id == NULL || strcmp(desc->format,id) != 0) {
+ DEBUG(0,("check_printjob_info: invalid format %s\n",
+ id ? id : "<NULL>" ));
+ return False;
+ }
return True;
}
@@ -3762,9 +3773,13 @@
desc->format = "zzzWWzzzWW";
break;
default:
+ DEBUG(0,("check_printdest_info: invalid level %d\n",
+ uLevel));
return False;
}
- if (strcmp(desc->format,id) != 0) {
+ if (id == NULL || strcmp(desc->format,id) != 0) {
+ DEBUG(0,("check_printdest_info: invalid string %s\n",
+ id ? id : "<NULL>" ));
return False;
}
return True;
Modified: branches/SAMBA_3_0_25/source/smbd/lanman.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/lanman.c 2007-04-03 22:59:55 UTC (rev 22064)
+++ branches/SAMBA_3_0_25/source/smbd/lanman.c 2007-04-04 00:03:12 UTC (rev 22065)
@@ -441,12 +441,18 @@
desc->subformat = "z";
break;
default:
+ DEBUG(0,("check_printq_info: invalid level %d\n",
+ uLevel ));
return False;
}
- if (strcmp(desc->format,id1) != 0) {
+ if (id1 == NULL || strcmp(desc->format,id1) != 0) {
+ DEBUG(0,("check_printq_info: invalid format %s\n",
+ id1 ? id1 : "<NULL>" ));
return False;
}
- if (desc->subformat && strcmp(desc->subformat,id2) != 0) {
+ if (desc->subformat && (id2 == NULL || strcmp(desc->subformat,id2) != 0)) {
+ DEBUG(0,("check_printq_info: invalid subformat %s\n",
+ id2 ? id2 : "<NULL>" ));
return False;
}
return True;
@@ -802,9 +808,7 @@
}
uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
str3 = get_safe_str_ptr(param,tpscnt,p,4);
- if (!str3) {
- return False;
- }
+ /* str3 may be null here and is checked in check_printq_info(). */
/* remove any trailing username */
if ((p = strchr_m(QueueName,'%')))
@@ -917,7 +921,7 @@
int *subcntarr = NULL;
int queuecnt = 0, subcnt = 0, succnt = 0;
- if (!param_format || !output_format1 || !p || !output_format2) {
+ if (!param_format || !output_format1 || !p) {
return False;
}
@@ -2682,9 +2686,16 @@
case 2: desc->format = "WWzWWDDzz"; break;
case 3: desc->format = "WWzWWDDzzzzzzzzzzlz"; break;
case 4: desc->format = "WWzWWDDzzzzzDDDDDDD"; break;
- default: return False;
+ default:
+ DEBUG(0,("check_printjob_info: invalid level %d\n",
+ uLevel ));
+ return False;
}
- if (strcmp(desc->format,id) != 0) return False;
+ if (id == NULL || strcmp(desc->format,id) != 0) {
+ DEBUG(0,("check_printjob_info: invalid format %s\n",
+ id ? id : "<NULL>" ));
+ return False;
+ }
return True;
}
@@ -3761,9 +3772,13 @@
desc->format = "zzzWWzzzWW";
break;
default:
+ DEBUG(0,("check_printdest_info: invalid level %d\n",
+ uLevel));
return False;
}
- if (strcmp(desc->format,id) != 0) {
+ if (id == NULL || strcmp(desc->format,id) != 0) {
+ DEBUG(0,("check_printdest_info: invalid string %s\n",
+ id ? id : "<NULL>" ));
return False;
}
return True;
More information about the samba-cvs
mailing list