[cvsnt] Reported author problem running cvsnt with cygwin/sshd on Windows Server 2003.

Dwight Schauer dschauer at gmail.com
Thu Oct 5 03:24:57 BST 2006


I'm running cvsnt-2.5.03.2382 with cygwin/sshd on Windows Server 2003. The
only problem I'm running into is that the commit author is being reported
wrong. I believe the real source of this problem is with cygwin/sshd, but I
was able to come up with a workaround in cvsnt.

The user for cgywin sshd on ws2k3 defaults to "sshd_server", not "SYSTEM".
In order for key based password-less logins to work on ws2k3 sygwin/sshd, a
user other than "SYSTEM" must be used. Vista has the same issue, but I don't
plan be running my cvsnt server on Vista any time soon.

The function win32getlogin in windows-NT/win32.cpp in the cvsnt source code
checks for "SYSTEM" and if the user name is that, it corrects with
the actual user name from the environment. It would be nice if it checked
for "sshd_server" as well.

I reconfigured cygwin/sshd to use "sshd_s" instead of "sshd_server"
by replacing all instances of "sshd_server" in ssh-host-config with
"sshd_s".

I then edited the cvsnt binary, cvs.exe, and changed "SYSTEM" to "sshd_s".
(There was only one instance of "SYSTEM" in the binary, so the change was
easy).

The commit author is now being reported correctly.

The patch I'm suggesting might look something like this:
--< start patch >--
--- win32.cpp.orig      2006-10-04 20:59:42.203399500 -0500
+++ win32.cpp   2006-10-04 21:02:58.894912000 -0500
@@ -615,7 +615,7 @@
                return NULL;

        /* Patch for cygwin sshd suggested by Markus Kuehni */
-       if(!strcmp(UserName,"SYSTEM"))
+       if(!strcmp(UserName,"SYSTEM") || !strcmp(UserName,"sshd_server"))
        {
                /* First try logname, and if that fails try user */

if(!GetEnvironmentVariableA("LOGNAME",UserName,sizeof(UserName)))
--< end patch >--

I looked that source of cvsnt-2.5.03.2382 and cvsnt-2.5.04.2471 when
considering this patch.

If it were up to me (and I know it is not) I'd rather see the GetUserNameA
call removed all together, and the user name gotten from the environment all
the time, but there may be other reasons why GetUserNameA is is being used.

For now I can manage with the patched binary, but it is far from ideal. I've
not gotten around to setting up a proper build environment for cvsnt on
Windows, which is why I did not recompile with the change.

--
Dwight Schauer


More information about the cvsnt mailing list