? modules/simpletest/tests/343502.test
? modules/simpletest/tests/343502.test.txt
? sites/all/modules
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1014
diff -u -p -r1.1014 node.module
--- modules/node/node.module	17 Jan 2009 20:56:04 -0000	1.1014
+++ modules/node/node.module	20 Jan 2009 21:52:46 -0000
@@ -1201,7 +1201,7 @@ function node_build_content($node, $teas
 
   // Allow modules to make their own additions to the node.
   node_invoke_nodeapi($node, 'view', $teaser);
-  
+
   // Allow modules to modify the structured node.
   drupal_alter('node_view', $node, $teaser);
 
@@ -2169,7 +2169,9 @@ function node_search_validate($form, &$f
 function node_access($op, $node, $account = NULL) {
   global $user;
 
-  if (!$node) {
+  if (!$node || !in_array($op, array('view', 'update', 'delete', 'create'), TRUE)) {
+    // If there was no node to check against, or the $op was not one of the
+    // supported ones, we return access denied.
     return FALSE;
   }
   // Convert the node to an object if necessary:
@@ -2384,10 +2386,10 @@ function node_query_node_access_alter(Qu
       if (count($or->conditions())) {
         $query->condition($or);
       }
-      
+
       $query->condition("{$access_alias}.grant_$op", 1, '>=');
     }
-  } 
+  }
 }
 
 /**
@@ -3019,7 +3021,7 @@ function node_list_permissions($type) {
  */
 function node_elements() {
   $type['node_links'] = array();
-  
+
   return $type;
 }
 
