summaryrefslogtreecommitdiff
path: root/source3/smbd/lanman.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-04 00:03:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:08 -0500
commit97e3cb896f284ba5330ad834a821a3a227e9abe4 (patch)
tree7ccc60dd42668a14c6b0272a6ae1a7a947d077df /source3/smbd/lanman.c
parentcab91684e51356215a4c764e1673e4fd8420b8e8 (diff)
downloadsamba-97e3cb896f284ba5330ad834a821a3a227e9abe4.tar.gz
samba-97e3cb896f284ba5330ad834a821a3a227e9abe4.tar.bz2
samba-97e3cb896f284ba5330ad834a821a3a227e9abe4.zip
r22065: 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 (This used to be commit 70875f92a22985539dc41e26a084218a45e1a13f)
Diffstat (limited to 'source3/smbd/lanman.c')
-rw-r--r--source3/smbd/lanman.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 4ca9a4b051..15e0284521 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -441,12 +441,18 @@ static int check_printq_info(struct pack_desc* desc,
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 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, uint16 vuid,
}
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 @@ static BOOL api_DosPrintQEnum(connection_struct *conn, uint16 vuid,
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 @@ static int check_printjob_info(struct pack_desc* desc,
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 (id == NULL || strcmp(desc->format,id) != 0) {
+ DEBUG(0,("check_printjob_info: invalid format %s\n",
+ id ? id : "<NULL>" ));
+ return False;
}
- if (strcmp(desc->format,id) != 0) return False;
return True;
}
@@ -3762,9 +3773,13 @@ static int check_printdest_info(struct pack_desc* desc,
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;