summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-13 23:07:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:26 -0500
commitd1684fa82ef8720341179238b65a768777681f34 (patch)
treee62d00830b155681a6dce688ecbdf9e48029228c /source3/rpc_server
parent8f96b1bf0f03e05fbf2ded0856a03bd522549d7b (diff)
downloadsamba-d1684fa82ef8720341179238b65a768777681f34.tar.gz
samba-d1684fa82ef8720341179238b65a768777681f34.tar.bz2
samba-d1684fa82ef8720341179238b65a768777681f34.zip
r14353: Fix coverity bugs #61 and #62. Remember to divide by
the size of the data table. Clean up the struct a little. Jeremy. (This used to be commit 338538410d484a9358b60b05a86180275344ffa4)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 70432c34ca..9fd51c9e27 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -3441,25 +3441,22 @@ static uint32 size_of_notify_info_data(uint16 type, uint16 field)
{
int i=0;
- for (i = 0; i < sizeof(notify_info_data_table); i++)
- {
+ for (i = 0; i < (sizeof(notify_info_data_table)/sizeof(struct s_notify_info_data_table)); i++) {
if ( (notify_info_data_table[i].type == type)
- && (notify_info_data_table[i].field == field) )
- {
- switch(notify_info_data_table[i].size)
- {
- case NOTIFY_ONE_VALUE:
- case NOTIFY_TWO_VALUE:
- return 1;
- case NOTIFY_STRING:
- return 2;
-
- /* The only pointer notify data I have seen on
- the wire is the submitted time and this has
- the notify size set to 4. -tpot */
-
- case NOTIFY_POINTER:
- return 4;
+ && (notify_info_data_table[i].field == field) ) {
+ switch(notify_info_data_table[i].size) {
+ case NOTIFY_ONE_VALUE:
+ case NOTIFY_TWO_VALUE:
+ return 1;
+ case NOTIFY_STRING:
+ return 2;
+
+ /* The only pointer notify data I have seen on
+ the wire is the submitted time and this has
+ the notify size set to 4. -tpot */
+
+ case NOTIFY_POINTER:
+ return 4;
case NOTIFY_SECDESC:
return 5;
@@ -3476,23 +3473,23 @@ static uint32 size_of_notify_info_data(uint16 type, uint16 field)
Return the type of notify_info_data.
********************************************************************/
-static int type_of_notify_info_data(uint16 type, uint16 field)
+static uint32 type_of_notify_info_data(uint16 type, uint16 field)
{
- int i=0;
+ uint32 i=0;
- for (i = 0; i < sizeof(notify_info_data_table); i++) {
+ for (i = 0; i < (sizeof(notify_info_data_table)/sizeof(struct s_notify_info_data_table)); i++) {
if (notify_info_data_table[i].type == type &&
notify_info_data_table[i].field == field)
return notify_info_data_table[i].size;
}
- return False;
+ return 0;
}
/****************************************************************************
****************************************************************************/
-static int search_notify(uint16 type, uint16 field, int *value)
+static BOOL search_notify(uint16 type, uint16 field, int *value)
{
int i;
@@ -3521,10 +3518,8 @@ void construct_info_data(SPOOL_NOTIFY_INFO_DATA *info_data, uint16 type, uint16
info_data->enc_type = type_of_notify_info_data(type, field);
info_data->id = id;
-
}
-
/*******************************************************************
*
* fill a notify_info struct with info asked