Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.804
diff -u -p -r1.804 comment.module
--- modules/comment/comment.module	12 Nov 2009 06:46:44 -0000	1.804
+++ modules/comment/comment.module	16 Nov 2009 14:22:31 -0000
@@ -1699,6 +1699,8 @@ function comment_form($form, &$form_stat
           '#size' => 30,
           '#maxlength' => 60,
           '#autocomplete_path' => 'user/autocomplete',
+          '#element_validate' => array('user_element_validate_name'),
+          '#required' => TRUE,
           '#default_value' => $author,
           '#weight' => -1,
         );
@@ -1972,9 +1974,6 @@ function comment_form_validate($form, &$
       form_set_error('date', t('You have to specify a valid date.'));
     }
   }
-  if (isset($form_state['values']['author']) && !$account = user_load_by_name($form_state['values']['author'])) {
-    form_set_error('author', t('You have to specify a valid author.'));
-  }
 
   // Check validity of name, mail and homepage (if given).
   if (!$user->uid || isset($form_state['values']['is_anonymous'])) {
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1168
diff -u -p -r1.1168 node.module
--- modules/node/node.module	15 Nov 2009 00:23:57 -0000	1.1168
+++ modules/node/node.module	16 Nov 2009 14:22:31 -0000
@@ -885,14 +885,6 @@ function node_validate($node, $form = ar
   }
 
   if (user_access('administer nodes')) {
-    // Validate the "authored by" field.
-    if (!empty($node->name) && !($account = user_load_by_name($node->name))) {
-      // The use of empty() is mandatory in the context of usernames
-      // as the empty string denotes the anonymous user. In case we
-      // are dealing with an anonymous user we set the user ID to 0.
-      form_set_error('name', t('The username %name does not exist.', array('%name' => $node->name)));
-    }
-
     // Validate the "authored on" field.
     if (!empty($node->date) && strtotime($node->date) === FALSE) {
       form_set_error('date', t('You have to specify a valid date.'));
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.100
diff -u -p -r1.100 node.pages.inc
--- modules/node/node.pages.inc	8 Nov 2009 10:02:41 -0000	1.100
+++ modules/node/node.pages.inc	16 Nov 2009 14:22:31 -0000
@@ -212,6 +212,7 @@ function node_form($form, &$form_state, 
     '#title' => t('Authored by'),
     '#maxlength' => 60,
     '#autocomplete_path' => 'user/autocomplete',
+    '#element_validate' => array('user_element_validate_name'),
     '#default_value' => !empty($node->name) ? $node->name : '',
     '#weight' => -1,
     '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1080
diff -u -p -r1.1080 user.module
--- modules/user/user.module	13 Nov 2009 10:21:50 -0000	1.1080
+++ modules/user/user.module	16 Nov 2009 14:23:35 -0000
@@ -584,6 +584,27 @@ function user_validate_picture(&$form, &
 }
 
 /**
+ * Form element validation handler to validate a username.
+ *
+ * This function may be specified as #element_validate handler for any form
+ * element that expects a valid, existing username as value.
+ *
+ * Form elements should additionally set #required => TRUE when a valid user is
+ * required. Otherwise, it is assumed that an empty string will be used to
+ * denote the anonymous user.
+ *
+ * To validate the syntax of a username during registration, use
+ * user_validate_name() instead.
+ */
+function user_element_validate_name($element) {
+  // The condition of an empty string is mandatory in the context of usernames,
+  // since an empty string denotes the anonymous user.
+  if (isset($element['#value']) && $element['#value'] !== '' && !user_load_by_name($element['#value'])) {
+    form_error($element, t('The username %name does not exist.', array('%name' => $element['#value'])));
+  }
+}
+
+/**
  * Generate a random alphanumeric password.
  */
 function user_password($length = 10) {
