Lines Matching refs:pdom
147 register struct domain *pdom; in broadcast_proc_exit() local
178 for (pdom = known_domains; pdom != (struct domain *)NULL; in broadcast_proc_exit()
179 pdom = pdom->dom_pnext) { in broadcast_proc_exit()
181 if (pdom->dom_broadcaster_pid == pid) { in broadcast_proc_exit()
184 "ypbind event_handler: got match %s\n", pdom->dom_name); in broadcast_proc_exit()
187 broadcast_setup(pdom); in broadcast_proc_exit()
189 if (pdom->broadcaster_pipe != 0) { in broadcast_proc_exit()
190 xdr_destroy(&(pdom->broadcaster_xdr)); in broadcast_proc_exit()
191 fclose(pdom->broadcaster_pipe); in broadcast_proc_exit()
192 pdom->broadcaster_pipe = 0; in broadcast_proc_exit()
193 pdom->broadcaster_fd = -1; in broadcast_proc_exit()
195 pdom->dom_broadcaster_pid = 0; in broadcast_proc_exit()
205 broadcast_setup(pdom) in broadcast_setup() argument
206 struct domain *pdom; in broadcast_setup()
211 if (pdom->broadcaster_pipe) {
212 pdom->dom_report_success = -1;
213 if (xdr_ypbind_setdom(&(pdom->broadcaster_xdr), &req)) {
220 gettimeofday(&(pdom->lastping), NULL);
960 register struct domain *pdom; local
963 for (pdom = known_domains; pdom != (struct domain *)NULL;
964 pdom = pdom->dom_pnext) {
965 if (strcmp(pname, pdom->dom_name) == 0)
966 return (pdom);
971 if (pdom = (struct domain *)calloc(1, sizeof (struct domain))) {
972 pdom->dom_name = strdup(pname);
973 if (pdom->dom_name == NULL) {
974 free((char *)pdom);
979 pdom->dom_pnext = known_domains;
980 known_domains = pdom;
981 pdom->dom_boundp = FALSE;
982 pdom->dom_vers = YPVERS; /* This doesn't talk to old ypserv */
983 pdom->dom_binding = NULL;
984 pdom->dom_error = YPBIND_ERR_NOSERV;
985 pdom->ping_clnt = (CLIENT *)NULL;
986 pdom->dom_report_success = -1;
987 pdom->dom_broadcaster_pid = 0;
988 pdom->broadcaster_pipe = 0;
989 pdom->bindfile = -1;
990 pdom->lastping.tv_sec = 0;
991 pdom->lastping.tv_usec = 0; /* require ping */
992 pdom->cache_fp = 0;
993 sprintf(buf, "%s/%s/cache_binding", BINDING, pdom->dom_name);
994 pdom->cache_file = strdup(buf);
1005 return (pdom);
1009 ypbind_ping(pdom) in ypbind_ping() argument
1010 struct domain *pdom; in ypbind_ping()
1016 if (pdom->dom_boundp == FALSE)
1018 vers = pdom->dom_vers;
1020 if (pdom->ping_clnt == (CLIENT *) NULL) {
1021 pdom->ping_clnt = __nis_clnt_create(RPC_ANYFD,
1022 pdom->dom_binding->ypbind_nconf, 0,
1023 pdom->dom_binding->ypbind_svcaddr, 0,
1027 if (pdom->ping_clnt == (CLIENT *) NULL) {
1030 pdom->dom_boundp = FALSE;
1031 pdom->dom_error = YPBIND_ERR_NOSERV;
1041 if (clnt_call(pdom->ping_clnt,
1043 (char *)&pdom->dom_name, xdr_int, (char *)&isok,
1045 pdom->dom_boundp = isok;
1046 pdom->dom_binding->ypbind_lo_vers = vers;
1047 pdom->dom_binding->ypbind_hi_vers = vers;
1051 pdom->dom_binding->ypbind_lo_vers,
1052 pdom->dom_binding->ypbind_hi_vers);
1055 clnt_perror(pdom->ping_clnt, "ping");
1056 pdom->dom_boundp = FALSE;
1057 pdom->dom_error = YPBIND_ERR_NOSERV;
1059 (void) gettimeofday(&(pdom->lastping), NULL);
1060 if (pdom->ping_clnt)
1061 clnt_destroy(pdom->ping_clnt);
1062 pdom->ping_clnt = (CLIENT *)NULL;
1063 if (pdom->dom_boundp)
1064 cache_binding(pdom);
1259 cache_binding(pdom) in cache_binding() argument
1260 struct domain *pdom; in cache_binding()
1271 if (pdom->cache_file == 0)
1282 if (pdom->cache_fp) {
1283 fclose(pdom->cache_fp); /* automatically unlocks */
1284 unlink(pdom->cache_file);
1285 pdom->cache_fp = 0;
1288 fd = open(pdom->cache_file, O_CREAT|O_WRONLY, 0444);
1292 pdom->cache_fp = fdopen(fd, "w");
1293 if (pdom->cache_fp == 0) {
1298 xdrstdio_create(&xdrs, pdom->cache_fp, XDR_ENCODE);
1300 resp.ypbind_resp_u.ypbind_bindinfo = pdom->dom_binding;
1304 unlink(pdom->cache_file);
1305 fclose(pdom->cache_fp);
1306 pdom->cache_fp = 0;
1315 unlink(pdom->cache_file);
1316 fclose(pdom->cache_fp);
1317 pdom->cache_fp = 0;
1322 uncache_binding(pdom) in uncache_binding() argument
1323 struct domain *pdom; in uncache_binding()
1328 if (pdom->cache_fp != 0) {
1329 unlink(pdom->cache_file);
1330 fclose(pdom->cache_fp);
1331 pdom->cache_fp = 0;
1449 struct domain *pdom; in clean_cache() local
1455 for (pdom = known_domains; pdom != (struct domain *)NULL; in clean_cache()
1456 pdom = pdom->dom_pnext) { in clean_cache()
1457 if (pdom->cache_file) in clean_cache()
1458 unlink(pdom->cache_file); in clean_cache()