Bug 482892

Summary: Passsync service start and stop messages in Windows event viewer are not logged correctly
Product: Red Hat Directory Server Reporter: Jenny Severance <jgalipea>
Component: winsyncAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: Chandrasekar Kannan <ckannan>
Severity: high Docs Contact:
Priority: high    
Version: 8.1CC: benl, nkinder
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 8.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-29 23:09:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 249650, 493682    
Attachments:
Description Flags
windows application event viewer message
none
diffs
none
cvs commit log
none
patch2 none

Description Jenny Severance 2009-01-28 18:12:51 UTC
Description of problem:
When you stop and start the Passsync services on the Windows Directory Server - generic passsync services messages are logged and it is not possible to know what event has happened.  Please refer to the attached screenshot. 
Event ID 105 - is the service starting 
Event ID 144 - is the service stopping

Version-Release number of selected component (if applicable):
8.1

How reproducible:
always

Steps to Reproduce:
1. Install passsync on windows ADS
2. Open event viewer
3. Open services control panel and restart passsync
4. View the events logged in the Application event viewer.
  
Actual results:
Events are not specific due to reason supplied in attached screenshot

Expected results:
Service start and stop messages.

Additional info:

Comment 1 Jenny Severance 2009-01-28 18:13:23 UTC
Created attachment 330266 [details]
windows application event viewer message

Comment 2 Rich Megginson 2009-02-13 22:32:43 UTC
arg - looks like whoever coded this didn't finish the job :-( it is taking me forever to wade through this Windows event and resource code to figure out how this is supposed to work . . .

Comment 3 Rich Megginson 2009-02-13 23:54:20 UTC
Created attachment 331886 [details]
diffs

Comment 4 Rich Megginson 2009-02-16 22:19:03 UTC
Reviewed by: nkinder (Thanks!)
Fix Description: Looks like someone had started to tie in the message catalog/resources, but didn't get far enough.
1) I used rc to compile the .rc file into a .res file - this new .res file is being added to CVS (cvs add -kb)
2) I added dssynchmsg.res to the link line
3) I made sure the passsync.exe main called the Install() method which installs the message catalog where the Event Viewer can find it.  I had to make that code smarter, so it would not attempt to create/install something that was already there.
Platforms tested: Windows 2003 Server
Flag Day: no
Doc impact: no

Comment 5 Rich Megginson 2009-02-16 22:21:08 UTC
Created attachment 332137 [details]
cvs commit log

Comment 6 Jenny Severance 2009-03-12 14:21:54 UTC
Upon restart of the Password Synchronization service, three events are logged
in the event viewer.

1. The service was stopped.
2. The Password Synchronization Service service was installed.
3. The service was started.

Should not see installed message again.  

Maybe the new passsync.log message "PassSync service initialized" is related to logging this installed message?

Comment 7 Rich Megginson 2009-03-12 14:40:42 UTC
Fix Description: Omit "The Password Synchronization Service service was installed." message at service startup.

Checking in ntservice.cpp;
/cvs/dirsec/winsync/passwordsync/passsync/ntservice.cpp,v  <--  ntservice.cpp
new revision: 1.7; previous revision: 1.6
done


Index: ntservice.cpp
===================================================================
RCS file: /cvs/dirsec/winsync/passwordsync/passsync/ntservice.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ntservice.cpp	16 Feb 2009 22:20:21 -0000	1.6
+++ ntservice.cpp	12 Mar 2009 14:39:40 -0000	1.7
@@ -199,6 +199,7 @@
     // Get the executable file path
     TCHAR szFilePath[_MAX_PATH];
     ::GetModuleFileName(NULL, szFilePath, sizeof(szFilePath)/sizeof(*szFilePath));
+    int didinstall = FALSE;
 
 	// install if not already installed
 	if (!IsInstalled()) {
@@ -229,6 +230,7 @@
 		// clean up
 		::CloseServiceHandle(hService);
 		::CloseServiceHandle(hSCM);
+        didinstall = TRUE;
 	}
 
     // make registry entries to support logging messages
@@ -263,10 +265,12 @@
                     0,
                     REG_DWORD,
                     (CONST BYTE*)&dwData,
-                     sizeof(DWORD));
+                    sizeof(DWORD));
     ::RegCloseKey(hKey);
 
-    LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, m_szServiceName);
+    if (didinstall) {
+        LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, m_szServiceName);
+    }
 
     return TRUE;
 }

Comment 8 Jenny Severance 2009-03-16 16:08:37 UTC
fix verified Windows 2003 Enterprise Edition passsync v 1.1.0 newest build

Comment 9 Rich Megginson 2009-03-16 23:53:59 UTC
Created attachment 335457 [details]
patch2

Comment 10 Rich Megginson 2009-03-17 15:39:53 UTC
Resolves: bug 482892
Bug Description: Passsync service start and stop messages in Windows event viewer are not logged correctly
Reviewed by: nkinder (Thanks!)
Fix Description: For some reason, the code was not detecting that the service had already been installed and was installing it again.  We do not need to install the service in this code, that is done in the .msi file now.  I just got rid of that old code.
Platforms tested: Windows 2003 Server
Flag Day: no
Doc impact: no

Comment 11 Rich Megginson 2009-03-17 15:41:06 UTC
Checking in passwordsync/passsync/ntservice.cpp;
/cvs/dirsec/winsync/passwordsync/passsync/ntservice.cpp,v  <--  ntservice.cpp
new revision: 1.8; previous revision: 1.7
done

Comment 12 Rich Megginson 2009-03-17 15:50:37 UTC
*** Bug 489881 has been marked as a duplicate of this bug. ***

Comment 13 Jenny Severance 2009-03-18 14:10:04 UTC
fix verified - latest passsync.msi build - version 1.1.0

Comment 14 Chandrasekar Kannan 2009-04-29 23:09:52 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-0455.html