s3-samr: move chgpasswd.c out of smbd and into the samr server.
authorGünther Deschner <gd@samba.org>
Tue, 18 May 2010 10:06:23 +0000 (12:06 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 26 May 2010 20:17:02 +0000 (22:17 +0200)
Guenther

source3/Makefile.in
source3/include/proto.h
source3/rpc_server/srv_samr_chgpasswd.c [moved from source3/smbd/chgpasswd.c with 99% similarity]
source3/rpc_server/srv_samr_util.h
source3/winbindd/winbindd_pam.c

index bc0bca942e48284781b5fcd52eb64be89c531b99..16516448b43fff1348ec4486663bca2bf2c13b08 100644 (file)
@@ -618,6 +618,7 @@ RPC_NETLOG_OBJ = rpc_server/srv_netlog_nt.o \
 
 RPC_SAMR_OBJ = rpc_server/srv_samr_nt.o \
                rpc_server/srv_samr_util.o \
+               rpc_server/srv_samr_chgpasswd.o \
               librpc/gen_ndr/srv_samr.o
 
 RPC_INITSHUTDOWN_OBJ =  librpc/gen_ndr/srv_initshutdown.o rpc_server/srv_initshutdown_nt.o
@@ -777,7 +778,7 @@ SMBD_OBJ_MAIN = smbd/server.o
 
 BUILDOPT_OBJ = smbd/build_options.o
 
-SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
+SMBD_OBJ_SRV = smbd/files.o smbd/connection.o \
               smbd/utmp.o smbd/session.o smbd/map_username.o \
                smbd/dfree.o smbd/dir.o smbd/password.o smbd/conn.o \
               smbd/share_access.o smbd/fileio.o \
@@ -1254,7 +1255,7 @@ WINBINDD_OBJ1 = \
                auth/server_info_sam.o \
                auth/user_info.o \
                auth/pampass.o \
-               smbd/chgpasswd.o \
+               rpc_server/srv_samr_chgpasswd.o \
                ../nsswitch/libwbclient/wb_reqtrans.o
 
 WINBINDD_OBJ = \
index cadbbd99a1d4601c03c80856a55d6b9862cd6f20..92c757b1ef0d3edefb450c9e8f89aea799549838 100644 (file)
@@ -5365,20 +5365,6 @@ struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
 
 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
 
-/* The following definitions come from smbd/chgpasswd.c  */
-
-bool chgpasswd(const char *name, const struct passwd *pass,
-              const char *oldpass, const char *newpass, bool as_root);
-NTSTATUS pass_oem_change(char *user,
-                        uchar password_encrypted_with_lm_hash[516],
-                        const uchar old_lm_hash_encrypted[16],
-                        uchar password_encrypted_with_nt_hash[516],
-                        const uchar old_nt_hash_encrypted[16],
-                        enum samPwdChangeReason *reject_reason);
-NTSTATUS check_password_complexity(const char *username,
-                                  const char *password,
-                                  enum samPwdChangeReason *samr_reject_reason);
-
 /* The following definitions come from smbd/close.c  */
 
 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
similarity index 99%
rename from source3/smbd/chgpasswd.c
rename to source3/rpc_server/srv_samr_chgpasswd.c
index 3a23321889d4ce0732e60397c1f9ae74cfc931cc..2e76e55dfa447ee95caedda906a90c0b7e77cc40 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    Samba utility functions
    Copyright (C) Andrew Tridgell 1992-1998
@@ -48,6 +48,7 @@
 #include "includes.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "../lib/crypto/arcfour.h"
+#include "rpc_server/srv_samr_util.h"
 
 #if ALLOW_CHANGE_PASSWORD
 
@@ -206,7 +207,7 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass,
        stermios.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
        stermios.c_lflag |= ICANON;
 #ifdef ONLCR
-       stermios.c_oflag &= ~(ONLCR);
+       stermios.c_oflag &= ~(ONLCR);
 #endif
        if (tcsetattr(0, TCSANOW, &stermios) < 0)
        {
@@ -618,7 +619,7 @@ the string %%u, and the given string %s does not.\n", passwordprogram ));
 
 #else /* ALLOW_CHANGE_PASSWORD */
 
-bool chgpasswd(const char *name, const struct passwd *pass, 
+bool chgpasswd(const char *name, const struct passwd *pass,
               const char *oldpass, const char *newpass, bool as_root)
 {
        DEBUG(0, ("chgpasswd: Unix Password changing not compiled in (user=%s)\n", name));
@@ -700,20 +701,20 @@ static NTSTATUS check_oem_password(const char *user,
                password_encrypted = password_encrypted_with_lm_hash;
                encryption_key = lanman_pw;
        } else if (nt_pass_set) {
-               DEBUG(1, ("NT password change supplied for user %s, but we have no NT password to check it with\n", 
+               DEBUG(1, ("NT password change supplied for user %s, but we have no NT password to check it with\n",
                          user));
                return NT_STATUS_WRONG_PASSWORD;
        } else if (lm_pass_set) {
                if (lp_lanman_auth()) {
-                       DEBUG(1, ("LM password change supplied for user %s, but we have no LanMan password to check it with\n", 
+                       DEBUG(1, ("LM password change supplied for user %s, but we have no LanMan password to check it with\n",
                                  user));
                } else {
-                       DEBUG(1, ("LM password change supplied for user %s, but we have disabled LanMan authentication\n", 
+                       DEBUG(1, ("LM password change supplied for user %s, but we have disabled LanMan authentication\n",
                                  user));
                }
                return NT_STATUS_WRONG_PASSWORD;
        } else {
-               DEBUG(1, ("password change requested for user %s, but no password supplied!\n", 
+               DEBUG(1, ("password change requested for user %s, but no password supplied!\n",
                          user));
                return NT_STATUS_WRONG_PASSWORD;
        }
@@ -1009,7 +1010,7 @@ static NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *ne
        }
 
        if (pdb_get_account_policy(PDB_POLICY_MIN_PASSWORD_LEN, &min_len) && (str_charnum(new_passwd) < min_len)) {
-               DEBUG(1, ("user %s cannot change password - password too short\n", 
+               DEBUG(1, ("user %s cannot change password - password too short\n",
                          username));
                DEBUGADD(1, (" account policy min password len = %d\n", min_len));
                if (samr_reject_reason) {
index 9dbc8b5ad6bea3762ac87fd44269cfea7ba85f9d..fb6d02620ddc446f61b57fe0a783ec4f0a35f7cf 100644 (file)
@@ -61,3 +61,17 @@ void copy_id25_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo25 *from);
 void copy_id26_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo26 *from);
+
+/* The following definitions come from rpc_server/srv_samr_chgpasswd.c  */
+
+bool chgpasswd(const char *name, const struct passwd *pass,
+              const char *oldpass, const char *newpass, bool as_root);
+NTSTATUS pass_oem_change(char *user,
+                        uchar password_encrypted_with_lm_hash[516],
+                        const uchar old_lm_hash_encrypted[16],
+                        uchar password_encrypted_with_nt_hash[516],
+                        const uchar old_nt_hash_encrypted[16],
+                        enum samPwdChangeReason *reject_reason);
+NTSTATUS check_password_complexity(const char *username,
+                                  const char *password,
+                                  enum samPwdChangeReason *samr_reject_reason);
index cf5ffdf325bf117913e4a718517e291caef824d8..9848bea6feefc823ad603e253ce2d665e62323b7 100644 (file)
@@ -31,6 +31,7 @@
 #include "rpc_client/cli_netlogon.h"
 #include "smb_krb5.h"
 #include "../lib/crypto/arcfour.h"
+#include "rpc_server/srv_samr_util.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND