aha! Found the problem. We're using WINS, and some zones were set up
for reverse WINS lookup and others weren't, so I wasn't consistently
getting a host name back with gethostbyaddr. I was using QDCRDEVD to
retrieve the IP address for the client coming into the iSeries, but
depending which device (of the four on my desk) I was using determined
whether I could retrieve the host name.

Scott - your rexec code works great. Thanks for the help!

- Michael

On 8/14/07, Scott Klement <midrange-l@xxxxxxxxxxxxxxxx> wrote:
Thanks Vern...I was getting a -1 from the rexec() call, but the
errordesc was NULL, which gave me a 'host not found or bad
authentication' error.

Not necessarily. -1 just means "it failed" (and nothing more or less
than that.) The API will set 'errno' (the Unix/C error number) to a
number to indicate what went wrong. Most of the time, errno's value
will tell you what went wrong.

The API DOES NOT SET errorDescriptor to NULL!! Whether errorDescriptor
is null or not depends on the parameters you used when you called the API!

If errno=0 that means that it couldn't use errno to set the error. (The
standard Unix/C errno does not have values for "host not found" or "bad
password", so another means was needed.) In that situation, the API
will try to set errorDescriptor to -1 to indicate "host not found". Or
it will try to set it to a non-negative number to indicate that remote
authorization failed (i.e. bad userid or password)

However, if your program had set errorDescriptor to NULL (the C
equivalent of the *OMIT value used in RPG or CL, or OMITTED in COBOL)
then the API doesn't have an errorDescriptor to set! In which case you
won't know whether it's a "host not found" or whether it's "remote auth
failed".

However, you can't even begin to look at errorDescriptor until AFTER
you've determined that 'errno=0'. Otherwise, the value of
errorDescriptor is meaningless.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.