Dear Sun Managers -- problem solved. Please see original note *and*
interim posting which follow. Definite thanks go to:
stern@sunrise.East.Sun.COM (Hal Stern - NE Area Systems Engineer)
Mike Raffety <email@example.com>
Dan Stromberg - OAC-DCS <firstname.lastname@example.org>
email@example.com (John Justin Hough)
And any who show up after I send this. The problem (as redefined in
the interim summary) turned out to be: I need to be able to bind to the
different NIS servers to get the NIS maps I need. Mike pointed me to
the YPBINDPROC_SETDOM rpc function. I took a hint and found a copy
of ypset.c for FreeBSD (this program source is (C) de Raadt) and
figured out what I had to do from there:basically set up a clnt_call
to YPBINDPROC_SETDOM to bind to the proper NIS domain.
Thanks folks for the great and timely response!
================ Interim Summary and Original Post ===============
Dear Sun Managers --
An update to my situation... (see below for original post).
I now feel resolver(3) is _not_ going to help at all. I now can
successfully get to all the valid NIS domains and get their hosts
maps by doing the following:
o get the list of valid NIS domains (which I could already do)
Then, for each valid NIS domain, do the following:
o gethostbyname(...) and extract the IP address of the server
for the valid NIS domain
o system("/usr/etc/yp/ypset -d <valid NIS domain> \
<IP address of NIS server>; /bin/ypcat -d <valid NIS domain>
Instead of "system(2)", I'll use popen(2|3?) and extract the output.
Problems I see with this:
1) overhead of opening the shell to execute the ypset(8)
and ypcat(8) commands;
2) the ypset(8) command will fail unless it's run by root.
I do _not_ want this to run as root (limit my liability :-)
but will do so if necessary....
Does anyone out there have any input as to how I can get around these
The original resolver(3) how-to question is kind of moot -- I got a
copy of the O'Reilly & Associates DNS & BIND book and it actually
had coding examples in it -- didn't help solve my real problem but
got around the limitations of the man page.
Dear Sun Managers --
Running SunOS 4.1.3, minimal patches, NIS, and DNS.
What I really and truly want to do in C is the following:
o be on NIS server 'A', get an NIS map which gives me
all the valid NIS domains in the agency (this exists,
and is not a problem; I can do it using the yp_all...
o contact each NIS server from that list of valid NIS
domains and get their NIS hosts map
o contact an RPC-based server I wrote which will reside
on each of the machines in each of the hosts in each
of the valid domains.
This all used to work!! :-(
My problem: we've recently implemented routers which
do not allow broadcast messages, so I can not use (e.g.,
from the cmdline)
ypcat -d my.full.domain.name hosts
consequently, I also can now no longer do this in my client
The NIS server my client runs on will have the -ypset option
for ypbind, but I'm not sure how to interface with that from
'C'. As I understand it, from the cmdline, I would do
ypset -d my.full.domain.name -h <an IP address>
but, am not sure how that works, and am not sure how I would
do it in C.
So, I'm thinking I need to use the resolver(3) functions.
Herein is the problem: Has anyone been able to successfully
decipher the resolver(3) API? Have they been able to do
it from TFM?! Not me. AnswerBook doesn't help either.
I've tried a few FAQs, but nothing like this has hit me.
Backing out the routers is not an option, unfortunately.
Can some one please tell me how to (what order, what kinds
of params, etc.) use the functions on the resolver(3)
man page? I've tried res_mkquery and res_send, thinking
these would work hand-in-hand, but to no avail. I've turned
debug-mode on in nslookup and in my C code and compared the
two: My res_mkquery turns out the same as the one inside
nslookup, but doesn't seem to generate anything useful that
res_send can use???
More importantly, I guess, if there's an easier way to do
what I really, truly want to do (see above ;-) in C, considering
the router situation, I would really appreciate someone pointing
me in that direction.
If resolver(3) functions are the way to go, someone please help
me understand TFM... :-)
Thanks so much, in advance,
acting Senior Technical Advisor, System Programming Branch
Defense Intelligence Agency
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:02 CDT