public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* fgets() behaviour
@ 2001-03-31  7:23 Mike Everest
  2001-03-31 14:43 ` Robert Collins
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Everest @ 2001-03-31  7:23 UTC (permalink / raw)
  To: cygwin

Hi Folks,

i have this crazy problem with fgets behaviour.

background info:
i am trying to write an authenticator for squid cache running under cygwin.
i am writing my code using ms visual studio, bacause not only is it familiar
to me, but also all of my existing development is all in there - i hope
nobody will tell me that i have to throw it away and use gcc <sigh>

anyway, my authenticator runs just fine when i run it interactively, and it
behaves just like squid wants it
to (pass the authenticator "username<space>password\n", and he returns
"ERR\n" or "OK\n" accordingly.

problem is that when squid runs it, the call to fgets() returns error 32
(reported by ferror())

the basic code is like this:

setbuf(stdout, NULL);

while(fgets(buf, 255, stdin) != NULL)
{
 // do stuff
}

any pointers?

thanks and regards,

Mike.




--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fgets() behaviour
  2001-03-31  7:23 fgets() behaviour Mike Everest
@ 2001-03-31 14:43 ` Robert Collins
  2001-03-31 16:26   ` Mike Everest
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Collins @ 2001-03-31 14:43 UTC (permalink / raw)
  To: Mike Everest, cygwin

Hi Mike,
    strange to see you here :]

Is the error 32 a MS windows error? If it is , net helpmsg 32 tells me
that "The process cannot access the file because it is being used by
another process.". It sounds like it might be an issue with exec'd
process with replaced stdin...

Try running it in a wrapper script (Pop back to squid-users, look in the
recent archives, Henrik posted a wrapper script for someone who had
problems with their helper exiting. A short modification  of that script
and you should be able to test it.

If the script works uner a bash script, it should work under squid. If
it doesn't work under bash then you've got a smaller test case for
cygwin.

Rob


----- Original Message -----
From: "Mike Everest" <mike@gsat.net.au>
To: <cygwin@cygwin.com>
Sent: Sunday, April 01, 2001 1:18 AM
Subject: fgets() behaviour


> Hi Folks,
>
> i have this crazy problem with fgets behaviour.
>
> background info:
> i am trying to write an authenticator for squid cache running under
cygwin.
> i am writing my code using ms visual studio, bacause not only is it
familiar
> to me, but also all of my existing development is all in there - i
hope
> nobody will tell me that i have to throw it away and use gcc <sigh>
>
> anyway, my authenticator runs just fine when i run it interactively,
and it
> behaves just like squid wants it
> to (pass the authenticator "username<space>password\n", and he returns
> "ERR\n" or "OK\n" accordingly.
>
> problem is that when squid runs it, the call to fgets() returns error
32
> (reported by ferror())
>
> the basic code is like this:
>
> setbuf(stdout, NULL);
>
> while(fgets(buf, 255, stdin) != NULL)
> {
>  // do stuff
> }
>
> any pointers?
>
> thanks and regards,
>
> Mike.
>
>
>
>
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
>
>


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fgets() behaviour
  2001-03-31 14:43 ` Robert Collins
@ 2001-03-31 16:26   ` Mike Everest
  2001-04-01  0:04     ` Robert Collins
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Everest @ 2001-03-31 16:26 UTC (permalink / raw)
  To: Robert Collins; +Cc: cygwin

Hello Rob!

>     strange to see you here :]

i've been getting about since i started toying with this stuff ;-)

> Try running it in a wrapper script (Pop back to squid-users, look in the
> recent archives, Henrik posted a wrapper script for someone who had
> problems with their helper exiting. A short modification  of that script
> and you should be able to test it.

thanks for that advice...

i have used this:
#!/usr/bin/perl

open(AUTH,"|/usr/local/sqltest.exe") ||die("Failed to start pam_auth");

select AUTH; $|=1;

select STDOUT; $|=1;

while(<>) {print AUTH$_;}

but it doesn't even run the auth module...  excuse me if i am blatantly off
the track :-}

regards.





--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fgets() behaviour
  2001-03-31 16:26   ` Mike Everest
@ 2001-04-01  0:04     ` Robert Collins
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Collins @ 2001-04-01  0:04 UTC (permalink / raw)
  To: Mike Everest; +Cc: cygwin

----- Original Message -----
From: "Mike Everest" <mike@gsat.net.au>
To: "Robert Collins" <robert.collins@itdomain.com.au>
Cc: <cygwin@cygwin.com>
Sent: Sunday, April 01, 2001 10:22 AM
Subject: Re: fgets() behaviour


> Hello Rob!
>
> >     strange to see you here :]
>
> i've been getting about since i started toying with this stuff ;-)
>
> > Try running it in a wrapper script (Pop back to squid-users, look in
the
> > recent archives, Henrik posted a wrapper script for someone who had
> > problems with their helper exiting. A short modification  of that
script
> > and you should be able to test it.
>
> thanks for that advice...
>
> i have used this:
> #!/usr/bin/perl
>
> open(AUTH,"|/usr/local/sqltest.exe") ||die("Failed to start
pam_auth");
>
> select AUTH; $|=1;
>
> select STDOUT; $|=1;
>
> while(<>) {print AUTH$_;}
>

1) type -p perl should return /usr/bin/perl or /usr/bin/perl.exe - does
it?
2) does  /usr/local/sqltest.exe exist?
3) Does your userthe user you are running squid as have rx rights to
/usr/local/sqltest.exe? (hint: ls -l sqltest.exe in /usr/local)

Rob

> but it doesn't even run the auth module...  excuse me if i am
blatantly off
> the track :-}
>
> regards.
>
>
>
>
>


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-04-01  0:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-31  7:23 fgets() behaviour Mike Everest
2001-03-31 14:43 ` Robert Collins
2001-03-31 16:26   ` Mike Everest
2001-04-01  0:04     ` Robert Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).