Lm th? no ? thay ?i m?t kh?u Windows 2000 c?a ng?i dng thng qua LDAP

D?ch tiu ? D?ch tiu ?
ID c?a bi: 269190 - Xem s?n ph?m m bi ny p d?ng vo.
Ch ?
Bi vi?t ny p d?ng cho Windows 2000. H? tr? cho Windows 2000 k?t thc vo ngy 13 thng 7 nm 2010. Cc Trung tm gi?i php k?t thc h? tr? Windows 2000 l m?t i?m kh?i ?u ? l?p k? ho?ch chi?n l?c c?a b?n di chuy?n t? Windows 2000. ? bi?t thm thng tin xem cc Chnh sch v?ng ?i h? tr? c?a Microsoft.
Bung t?t c? | Thu g?n t?t c?


B?n c th? thi?t l?p m?t ng?i dng Windows 2000 m?t kh?u thng qua cc Lightweight Directory Access Protocol (LDAP) ?c h?n ch? nh?t ?nh. Bi vi?t ny m t? lm th? no ? ?t ho?c thay ?i cc thu?c tnh m?t kh?u.


M?t kh?u ?c lu tr? trong th m?c ho?t ?ng trn m?t ?i t?ng ng?i s? d?ng trong cc unicodePwd thu?c tnh. Thu?c tnh ny c th? ?c ghi trong i?u ki?n b? gi?i h?n, nhng n khng th? ?c ?c. Cc thu?c tnh ch? c th? s?a ?i; n khng th? ?c thm vo sng t?o ?i t?ng ho?c truy v?n b?i m?t t?m ki?m. ? s?a ?i cc thu?c tnh ny, khch hng ph?i c m?t 128-bit Secure Socket Layer (SSL) k?t n?i t?i h? ph?c v?. Cho k?t n?i ny c th?, h? ph?c v? ph?i c m?t ch?ng ch? my ch? k?t n?i 128-bit RSA, khch hng ph?i tin t?ng authority gi?y ch?ng nh?n (CA) m t?o ra ch?ng ch? my ch? v my khch v h? ph?c v? ph?i ?c c kh? nng m? ha 128-bit.

C php c?a cc unicodePwd thu?c tnh l octet-chu?i; Tuy nhin, cc d?ch v? th m?c s? octet-chu?i s? ch?a m?t chu?i UNICODE (nh tn g?i c?a cc thu?c tnh cho bi?t). Ny c ngh?a l b?t k? gi tr? cho thu?c tnh ny thng qua t?i LDAP ph?i l UNICODE dy ?c m? ha BER (c b?n m? ha quy) nh m?t octet-chu?i. Ngoi ra, chu?i UNICODE ph?i b?t ?u v k?t thc trong d?u ngo?c kp khng ph?i l m?t ph?n c?a m?t kh?u mong mu?n.

C hai cch c th? ? s?a ?i cc unicodePwd thu?c tnh. ?u tin l tng t? nh m?t b?nh th?ng "ng?i dng thay ?i m?t kh?u" chi?n d?ch. Trong tr?ng h?p ny, yu c?u s?a ?i ph?i ch?a m?t xa v m?t ho?t ?ng thm. Thao tc xa ph?i c m?t kh?u hi?n th?i v?i d?u ngo?c kp quanh n. Chi?n d?ch thm ph?i c mong mu?n m?t kh?u m?i v?i d?u ngo?c kp quanh n.

Cch th? hai ? s?a ?i cc thu?c tnh ny l tng t? nh ng?i qu?n tr? ?t l?i m?t kh?u cho ng?i dng. ? th?c hi?n vi?c ny, khch hng ph?i rng bu?c nh m?t ng?i s? d?ng v?i ? quy?n ? thay ?i m?t kh?u c?a ng?i dng khc. Yu c?u s?a ?i ny nn ch?a m?t ho?t ?ng n l? thay th? v?i mong mu?n m?t kh?u m?i bao quanh b?i cc d?u ngo?c kp. N?u khch hng c ? quy?n, m?t kh?u ny tr? thnh m?t kh?u m?i, b?t k? c?a m?t kh?u c? ? nh?ng g?.

Hai ch?c nng sau y cung c?p cc v d? v? cc ho?t ?ng ny:
ULONG ChangeUserPassword(WCHAR* pszUserDN, WCHAR* pszOldPassword,WCHAR* pszNewPassword)
	ULONG err = 1;
	LDAPMod modNewPassword;
	LDAPMod modOldPassword;
	LDAPMod *modEntry[3];
	BERVAL newPwdBerVal;
	BERVAL oldPwdBerVal;
	BERVAL *newPwd_attr[2];
	BERVAL *oldPwd_attr[2];
	WCHAR pszNewPasswordWithQuotes[1024];
	WCHAR pszOldPasswordWithQuotes[1024];

	// Build an array of LDAPMod.

	// For setting unicodePwd, this MUST be a double op.
	modEntry[0] = &modOldPassword;
	modEntry[1] = &modNewPassword;
	modEntry[2] = NULL;

	// Build mod struct for unicodePwd Add.
	modNewPassword.mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES;
	modNewPassword.mod_type =	L"unicodePwd";
	modNewPassword.mod_vals.modv_bvals = newPwd_attr;

	// Build mod struct for unicodePwd Delete.
	modOldPassword.mod_op = LDAP_MOD_DELETE | LDAP_MOD_BVALUES;
	modOldPassword.mod_type =	L"unicodePwd";
	modOldPassword.mod_vals.modv_bvals = oldPwd_attr;

	// Password will be single valued, so we only have one element.
	newPwd_attr[0] = &newPwdBerVal;
	newPwd_attr[1]= NULL;
	oldPwd_attr[0] = &oldPwdBerVal;
	oldPwd_attr[1]= NULL;

	// Surround the passwords in quotes.

	// Build the BER structures with the UNICODE passwords w/quotes.
	newPwdBerVal.bv_len = wcslen(pszNewPasswordWithQuotes) * sizeof(WCHAR);
	newPwdBerVal.bv_val = (char*)pszNewPasswordWithQuotes;
	oldPwdBerVal.bv_len = wcslen(pszOldPasswordWithQuotes) * sizeof(WCHAR);
	oldPwdBerVal.bv_val = (char*)pszOldPasswordWithQuotes;

	// Perform single modify.
	err = ldap_modify_s(ldapConnection,

	if (err == LDAP_SUCCESS )
		wprintf(L"\nPassword succesfully changed!\n");
		wprintf(L"\nPassword change failed!\n");

	return err;

ULONG SetUserPassword(WCHAR* pszUserDN, WCHAR* pszPassword)
	ULONG err = 1;
	LDAPMod modPassword;
	LDAPMod *modEntry[2];
	BERVAL pwdBerVal;
	BERVAL *pwd_attr[2];
	WCHAR pszPasswordWithQuotes[1024];

	// Build an array of LDAPMod.
	// For setting unicodePwd, this MUST be a single op.
	modEntry[0] = &modPassword;
	modEntry[1] = NULL;

	// Build mod struct for unicodePwd. 
	modPassword.mod_op = LDAP_MOD_REPLACE | LDAP_MOD_BVALUES;
	modPassword.mod_type =	L"unicodePwd";
	modPassword.mod_vals.modv_bvals = pwd_attr;

	// Password will be single valued, so we only have one element.
	pwd_attr[0] = &pwdBerVal;
	pwd_attr[1]= NULL;

	// Surround the password in quotes.

	// Build the BER structure with the UNICODE password.
	pwdBerVal.bv_len = wcslen(pszPasswordWithQuotes) * sizeof(WCHAR);
	pwdBerVal.bv_val = (char*)pszPasswordWithQuotes;

	// Perform single modify.
	err = ldap_modify_s(ldapConnection,

	if (err == LDAP_SUCCESS )
		wprintf(L"\nPassword succesfully set!\n");
		wprintf(L"\nPassword set failed!\n");

	return err;

Thu?c tnh

ID c?a bi: 269190 - L?n xem xt sau cng: 22 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
T? kha:
kbhowto kbmsg kbmt KB269190 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:269190

Cung cp Phan hi


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com