|
|
1.1 root 1: /* hunk.c
2: Get information about an unknown system from the HDB Permissions file.
3:
4: Copyright (C) 1992 Ian Lance Taylor
5:
6: This file is part of the Taylor UUCP uuconf library.
7:
8: This library is free software; you can redistribute it and/or
9: modify it under the terms of the GNU Library General Public License
10: as published by the Free Software Foundation; either version 2 of
11: the License, or (at your option) any later version.
12:
13: This library is distributed in the hope that it will be useful, but
14: WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: Library General Public License for more details.
17:
18: You should have received a copy of the GNU Library General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21:
22: The author of the program may be contacted at [email protected] or
23: c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
24: */
25:
26: #include "uucnfi.h"
27:
28: #if USE_RCS_ID
29: const char _uuconf_hunk_rcsid[] = "$Id: hunk.c,v 1.1 93/07/30 08:07:20 bin Exp Locker: bin $";
30: #endif
31:
32: #include <errno.h>
33:
34: /* Get information about an unknown system from the HDB Permissions
35: file. This doesn't run the remote.unknown shell script, because
36: that's too system dependent. */
37:
38: int
39: uuconf_hdb_system_unknown (pglobal, qsys)
40: pointer pglobal;
41: struct uuconf_system *qsys;
42: {
43: struct sglobal *qglobal = (struct sglobal *) pglobal;
44: int iret;
45: boolean ffirst;
46: struct shpermissions *qperm;
47: struct uuconf_system *qalt;
48:
49: if (! qglobal->qprocess->fhdb_read_permissions)
50: {
51: iret = _uuconf_ihread_permissions (qglobal);
52: if (iret != UUCONF_SUCCESS)
53: return iret;
54: }
55:
56: _uuconf_uclear_system (qsys);
57: qsys->uuconf_palloc = uuconf_malloc_block ();
58: if (qsys->uuconf_palloc == NULL)
59: {
60: qglobal->ierrno = errno;
61: return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
62: }
63:
64: ffirst = TRUE;
65:
66: for (qperm = qglobal->qprocess->qhdb_permissions;
67: qperm != NULL;
68: qperm = qperm->qnext)
69: {
70: char **pz;
71:
72: if (qperm->pzlogname == NULL
73: || qperm->pzlogname == (char **) &_uuconf_unset)
74: continue;
75:
76: for (pz = qperm->pzlogname; *pz != NULL; pz++)
77: {
78: if (ffirst)
79: {
80: qalt = qsys;
81: ffirst = FALSE;
82: }
83: else
84: {
85: struct uuconf_system **pq;
86:
87: qalt = ((struct uuconf_system *)
88: uuconf_malloc (qsys->uuconf_palloc,
89: sizeof (struct uuconf_system)));
90: if (qalt == NULL)
91: {
92: qglobal->ierrno = errno;
93: return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
94: }
95:
96: _uuconf_uclear_system (qalt);
97: for (pq = &qsys->uuconf_qalternate;
98: *pq != NULL;
99: pq = &(*pq)->uuconf_qalternate)
100: ;
101: *pq = qalt;
102: }
103:
104: /* We recognize LOGNAME=OTHER specially, although this
105: appears to be an SCO innovation. */
106: if (strcmp (*pz, "OTHER") == 0)
107: qalt->uuconf_zcalled_login = (char *) "ANY";
108: else
109: qalt->uuconf_zcalled_login = *pz;
110: qalt->uuconf_fcall = FALSE;
111: qsys->uuconf_fcalled = TRUE;
112: if (qperm->frequest >= 0)
113: qsys->uuconf_fsend_request = qperm->frequest;
114: else
115: qsys->uuconf_fsend_request = FALSE;
116: qsys->uuconf_fcalled_transfer = qperm->fsendfiles;
117: qsys->uuconf_pzremote_send = qperm->pzread;
118: qsys->uuconf_pzremote_receive = qperm->pzwrite;
119: qsys->uuconf_fcallback = qperm->fcallback;
120: qsys->uuconf_zlocalname = qperm->zmyname;
121: qsys->uuconf_zpubdir = qperm->zpubdir;
122: }
123: }
124:
125: if (ffirst)
126: return UUCONF_NOT_FOUND;
127:
128: /* HDB permits local requests to receive to any directory, which is
129: not the default put in by _uuconf_isystem_basic_default. We set
130: it here instead. */
131: for (qalt = qsys; qalt != NULL; qalt = qalt->uuconf_qalternate)
132: {
133: iret = _uuconf_iadd_string (qglobal, (char *) ZROOTDIR,
134: FALSE, FALSE,
135: &qalt->uuconf_pzlocal_receive,
136: qsys->uuconf_palloc);
137: if (iret != UUCONF_SUCCESS)
138: return iret;
139: }
140:
141: return _uuconf_isystem_basic_default (qglobal, qsys);
142: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.