exim 4.12-3 winsock problem (was Re: 1.3.21)

Jason Tishler jason@tishler.net
Mon Feb 24 21:03:00 GMT 2003


Pierre,

[I'm moving this thread to cygwin@, since it currently doesn't appear to
be a cygwin-developers@ issue...]

On Fri, Feb 21, 2003 at 02:12:09PM -0500, Jason Tishler wrote:
> On Fri, Feb 21, 2003 at 01:22:01PM -0500, Pierre A. Humblet wrote:
> > This reminds me of something similar, possibly last month.  Look for
> > "exim", "services", "gerritt" In the end it was because exim was
> > running as a special user who didn't have permission on the whole
> > tree under c:\winnt.  First make sure Everybody has rx access to it.

You may be onto something, see below...

> I found some 770s, changed them to 775, but still no luck.
> 
> The above doesn't explain why the attached works when run under the
> exim account even with the "bad" permissions:
> 
>     $ ssh exim@localhost /tmp/getservbyname
>     getservbyname(smtp, tcp) succeeded
>     port = 6400
> 
> It also doesn't explain with gdb and strace "fixed" the bad
> permissions too.

See below...

On Fri, Feb 21, 2003 at 01:33:17PM -0500, Pierre A. Humblet wrote:
> FYI here is some correspondence from the previous similar problem. I
> had a private debugging conversation involving sending long straces
> etc...
>  
> It was a winsock error due to permission problem.  winsock didn't init
> properly, and cywin went ahead anyway!
> 
> *******************
> Thanks. It's definitely a winsock error.
> Looking into it.
> 
>   627  272260 [main] exim-4.12-2 2816 wsock_init: res 10107 <==== SHOULD BE 0

Since the problem "goes away" with strace and in gdb, I have hacked my
DLL with the attached patches.  When I start exim under the LocalSystem
and exim accounts, I get the following:

    $ exim -bdf -q15m
    wsock_init(): wsock_started = 0
    wsock_init():  wsastartup = 0x7503d2c3
    wsock_init(): wsastartup() returned 10107
    getservbyname() failed with last error = 10093

Any further suggestions?  Note this is very painful to debug because I
can't use gdb and I can't send mail when trying to debug.  Sigh...  :,(

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
Index: autoload.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/autoload.cc,v
retrieving revision 1.62
diff -u -p -r1.62 autoload.cc
--- autoload.cc	20 Feb 2003 11:12:44 -0000	1.62
+++ autoload.cc	24 Feb 2003 19:31:48 -0000
@@ -240,12 +240,15 @@ std_dll_init ()
   return ret.ll;
 }
 
+#include <stdio.h>
+
 /* Initialization function for winsock stuff. */
 static long long wsock_init () __asm__ ("wsock_init") __attribute__ ((unused, regparm(1)));
 bool NO_COPY wsock_started = 0;
 static long long
 wsock_init ()
 {
+  printf("wsock_init(): wsock_started = %ld\n", wsock_started);
   static LONG NO_COPY here = -1L;
   struct func_info *func = (struct func_info *) __builtin_return_address (0);
   struct dll_info *dll = func->dll;
@@ -273,9 +276,14 @@ wsock_init ()
 
       wsastartup = (int (*)(int, WSADATA *))
 		   GetProcAddress ((HMODULE) (dll->handle), "WSAStartup");
+      printf("wsock_init():  wsastartup = %p\n", wsastartup);
       if (wsastartup)
 	{
 	  int res = wsastartup ((2<<8) | 2, &wsadata);
+	  printf("wsock_init(): wsastartup() returned %d\n", res);
+	  if (res == 0)
+	    printf("winsock_active = %ld, winsock2_active = %ld\n",
+		   winsock_active, winsock2_active);
 
 	  debug_printf ("res %d", res);
 	  debug_printf ("wVersion %d", wsadata.wVersion);
-------------- next part --------------
Index: net.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/net.cc,v
retrieving revision 1.140
diff -u -p -r1.140 net.cc
--- net.cc	20 Feb 2003 14:14:37 -0000	1.140
+++ net.cc	24 Feb 2003 19:31:14 -0000
@@ -849,6 +849,8 @@ out:
 static struct servent *servent_buf = NULL;
 #endif
 
+#include <stdio.h>
+
 /* exported as getservbyname: standards? */
 extern "C" struct servent *
 cygwin_getservbyname (const char *name, const char *proto)
@@ -863,6 +865,9 @@ cygwin_getservbyname (const char *name, 
   servent_buf = dup_servent_ptr (getservbyname (name, proto));
   if (!servent_buf)
     set_winsock_errno ();
+
+  if (!servent_buf)
+    printf("getservbyname() failed with last error = %ld\n", GetLastError ());
 
   syscall_printf ("%x = getservbyname (%s, %s)", servent_buf, name, proto);
   return servent_buf;

-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list