diff --git a/ldapauth.admin.inc b/ldapauth.admin.inc
index 3a2cbc6..d957fc3 100644
--- a/ldapauth.admin.inc
+++ b/ldapauth.admin.inc
@@ -67,6 +67,13 @@ function ldapauth_admin_settings() {
     '#default_value' => LDAPAUTH_SYNC_PASSWORDS,
     '#description' => t('If checked, then LDAP and Drupal passwords will be syncronized. This might be useful if some other modules need to authenticate against the user password hash stored in Drupal and works only in Mixed mode. It might introduce security issues in the Mixed mode since after deletion of the LDAP account user still be able to login to Drupal with his password. If unsure, leave this unchecked.'),
   );
+  
+ $form['security-options']['ldapauth_create_users'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Create new Drupal user if not present'),
+    '#default_value' => variable_get('ldapauth_create_users', true),
+    '#description' => t('If checked, then LDAP will create a new Drupal user against the user information supplied by the user authenticated by LDAP. If not checked only the already available users will be authenticated.'),
+  );
 
   $form['ldap-ui'] = array(
     '#type' => 'fieldset',
@@ -120,7 +127,7 @@ function ldapauth_admin_settings_submit($form, &$form_state) {
       variable_set('ldapauth_sync_passwords', $values['ldapauth_sync_passwords']);
       variable_set('ldapauth_disable_pass_change', $values['ldapauth_disable_pass_change']);
       variable_set('ldapauth_alter_email_field', $values['ldapauth_alter_email_field']);
-
+      variable_set('ldapauth_create_users', $values['ldapauth_create_users']);
       drupal_set_message(t('The configuration options have been saved.'));
       break;
     case t('Reset to defaults'):
@@ -130,7 +137,7 @@ function ldapauth_admin_settings_submit($form, &$form_state) {
       variable_del('ldapauth_sync_passwords');
       variable_del('ldapauth_disable_pass_change');
       variable_del('ldapauth_alter_email_field');
-
+      variable_del('ldapauth_create_users');
       drupal_set_message(t('The configuration options have been reset to their default values.'));
       break;
   }
diff --git a/ldapauth.install b/ldapauth.install
index 32972f0..832e23a 100644
--- a/ldapauth.install
+++ b/ldapauth.install
@@ -30,6 +30,7 @@ function ldapauth_uninstall() {
   variable_del('ldapauth_sync_passwords');
   variable_del('ldapauth_disable_pass_change');
   variable_del('ldapauth_alter_email_field');
+  variable_del('ldapauth_create_users');
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/ldapauth.module b/ldapauth.module
index 0dcd4e2..be46f4a 100644
--- a/ldapauth.module
+++ b/ldapauth.module
@@ -319,6 +319,11 @@ function ldapauth_authenticate($form_values = array()) {
     return;
 
   if (!$account) {
+    if (!variable_get('ldapauth_create_users', true)) {
+      form_set_error('name', t('Your account is not authorized to access this system.'));
+      watchdog('ldapauth', 'The name %name is trying to login using a unexisten user account and therefore could not be logged in.', array('%name' => $name), WATCHDOG_ERROR);
+      return;
+    }
     // Register this new user.
     if ($ldap_user = _ldapauth_user_lookup($name)) {
       // If mail attribute is missing, set the name as mail.
