[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-directory-commits
Subject:    [Fedora-directory-commits] winsync/passwordsync/passhook
From:       nkinder () fedoraproject ! org (Nathan Kinder)
Date:       2009-03-25 18:00:03
Message-ID: 20090325180003.16B9470133 () cvs1 ! fedora ! phx ! redhat ! com
[Download RAW message or body]

Author: nkinder

Update of /cvs/dirsec/winsync/passwordsync/passhook
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26335/passhook

Modified Files:
	passhook.cpp 
Log Message:
Related: 490048
Summary: Handle NULL Username and Password parameters in PasswordChangeNotify callback.



Index: passhook.cpp
===================================================================
RCS file: /cvs/dirsec/winsync/passwordsync/passhook/passhook.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- passhook.cpp	30 Mar 2006 22:59:25 -0000	1.9
+++ passhook.cpp	25 Mar 2009 18:00:00 -0000	1.10
@@ -59,11 +59,20 @@
 	fstream outLog;
 	DWORD waitRes;
 
+	// If UserName is NULL, just return STATUS_SUCCESS
+	if (UserName == NULL) {
+		goto exit;
+	}
+
 	// This memory will be freed in SavePasshookChange
 	if ( newPassInfo = (PASS_INFO *) malloc(sizeof(PASS_INFO)) ) {
 		// These get freed in SavePasshookChange by calling clearSet
 		newPassInfo->username = (char*)malloc((UserName->Length / 2) + 1);
-		newPassInfo->password = (char*)malloc((Password->Length / 2) + 1);
+		if (Password != NULL) {
+			newPassInfo->password = (char*)malloc((Password->Length / 2) + 1);
+		} else {
+			newPassInfo->password = (char*)malloc(1);
+		}
 	} else {
 		goto exit;
 	}
@@ -71,9 +80,13 @@
 	// Fill in the password change struct
 	if (newPassInfo->username && newPassInfo->password) {
                 _snprintf(newPassInfo->username, (UserName->Length / 2), "%S", UserName->Buffer);
-                _snprintf(newPassInfo->password, (Password->Length / 2), "%S", Password->Buffer);
-                newPassInfo->username[UserName->Length / 2] = '\0';
-                newPassInfo->password[Password->Length / 2] = '\0';
+		newPassInfo->username[UserName->Length / 2] = '\0';
+		if (Password != NULL) {
+                	_snprintf(newPassInfo->password, (Password->Length / 2), "%S", Password->Buffer);
+			newPassInfo->password[Password->Length / 2] = '\0';
+		} else {
+			newPassInfo->password[0] = '\0';
+		}
 
 		// Backoff
                 newPassInfo->backoffCount = 0;

--
Fedora-directory-commits mailing list
Fedora-directory-commits@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-directory-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic