summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-05-18 12:06:23 +0200
committerGünther Deschner <gd@samba.org>2010-05-26 22:17:02 +0200
commit2807ab358ec346a1da15522adce7f182d3ffefe5 (patch)
treeeafd88c92b500c74495c2005932a8078ffe68ea7 /source3
parent14b03d132bba45b368a07de4c4ed3ce73a8e1bde (diff)
downloadsamba-2807ab358ec346a1da15522adce7f182d3ffefe5.tar.gz
samba-2807ab358ec346a1da15522adce7f182d3ffefe5.tar.bz2
samba-2807ab358ec346a1da15522adce7f182d3ffefe5.zip
s3-samr: move chgpasswd.c out of smbd and into the samr server.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in5
-rw-r--r--source3/include/proto.h14
-rw-r--r--source3/rpc_server/srv_samr_chgpasswd.c (renamed from source3/smbd/chgpasswd.c)17
-rw-r--r--source3/rpc_server/srv_samr_util.h14
-rw-r--r--source3/winbindd/winbindd_pam.c1
5 files changed, 27 insertions, 24 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index bc0bca942e..16516448b4 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -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 = \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index cadbbd99a1..92c757b1ef 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/smbd/chgpasswd.c b/source3/rpc_server/srv_samr_chgpasswd.c
index 3a23321889..2e76e55dfa 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/rpc_server/srv_samr_chgpasswd.c
@@ -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) {
diff --git a/source3/rpc_server/srv_samr_util.h b/source3/rpc_server/srv_samr_util.h
index 9dbc8b5ad6..fb6d02620d 100644
--- a/source3/rpc_server/srv_samr_util.h
+++ b/source3/rpc_server/srv_samr_util.h
@@ -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);
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
index cf5ffdf325..9848bea6fe 100644
--- a/source3/winbindd/winbindd_pam.c
+++ b/source3/winbindd/winbindd_pam.c
@@ -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