|
|
1.1 root 1: /* rt2ssexec.c - RTPM: exec */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rtsap/RCS/rt2ssexec.c,v 7.1 90/07/01 21:07:08 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rtsap/RCS/rt2ssexec.c,v 7.1 90/07/01 21:07:08 mrose Exp $
9: *
10: *
11: * $Log: rt2ssexec.c,v $
12: * Revision 7.1 90/07/01 21:07:08 mrose
13: * pepsy
14: *
15: * Revision 6.0 89/03/18 23:43:19 mrose
16: * Release 5.0
17: *
18: */
19:
20: /*
21: * NOTICE
22: *
23: * Acquisition, use, and distribution of this module and related
24: * materials are subject to the restrictions of a license agreement.
25: * Consult the Preface in the User's Manual for the full terms of
26: * this agreement.
27: *
28: */
29:
30:
31: /* LINTLIBRARY */
32:
33: #include <stdio.h>
34: #include "RTS-types.h"
35: #include "OACS-types.h"
36: #include "rtpkt.h"
37: #include "isoservent.h"
38: #include "tailor.h"
39:
40: /* SERVER only */
41:
42: int RtExec (ss, rti, arg1, arg2, hook, setperms)
43: struct SSAPstart *ss;
44: struct RtSAPindication *rti;
45: char *arg1,
46: *arg2;
47: IFP hook,
48: setperms;
49: {
50: int result,
51: result2;
52: register struct isoservent *is;
53: register PE pe;
54: struct SSAPref ref;
55: struct SSAPindication sis;
56: register struct SSAPindication *si = &sis;
57: struct type_OACS_PConnect *pcon = NULL;
58:
59: missingP (ss);
60: missingP (rti);
61: missingP (arg1);
62: missingP (arg2);
63:
64: /* acsap_conntype = CN_OPEN, acsap_data = NULLPE; */
65: if ((pe = ssdu2pe (ss -> ss_data, ss -> ss_cc, NULLCP, &result)) == NULLPE
66: || parse_OACS_PConnect (pe, 1, NULLIP, NULLVP, &pcon) == NOTOK) {
67: if (pe)
68: pe_free (pe);
69: if (result == PS_ERR_NMEM) {
70: congest: ;
71: result = SC_CONGESTION, result2 = RTS_CONGEST;
72: }
73: else
74: result = SC_REJECTED, result2 = RTS_PROTOCOL;
75: goto out;
76: }
77:
78: PLOGP (rtsap_log,OACS_PConnect, pe, "PConnect", 1);
79:
80: pe_free (pe);
81:
82: if (pcon -> pUserData -> member_OACS_2 -> offset
83: != type_OACS_ConnectionData_open) {
84: result = SC_REJECTED, result2 = RTS_ADDRESS;
85: goto out;
86: }
87: if (is = getisoserventbyport ("rtsap",
88: (u_short) htons ((u_short) pcon -> pUserData -> applicationProtocol))) {
89: *is -> is_tail++ = arg1;
90: *is -> is_tail++ = arg2;
91: *is -> is_tail = NULL;
92: }
93: else {
94: result = SC_REJECTED, result2 = RTS_ADDRESS;
95: goto out;
96: }
97:
98: switch (hook ? (*hook) (is, rti) : OK) {
99: case NOTOK:
100: if (pcon)
101: free_OACS_PConnect(pcon);
102: return NOTOK;
103:
104: case DONE:
105: if (pcon)
106: free_OACS_PConnect(pcon);
107: return OK;
108:
109: case OK:
110: if (setperms)
111: (void) (*setperms) (is);
112: (void) execv (*is -> is_vec, is -> is_vec);/* fall */
113: SLOG (rtsap_log, LLOG_FATAL, *is -> is_vec, ("unable to exec"));
114: default:
115: goto congest;
116: }
117:
118: out: ;
119: if (pcon)
120: free_OACS_PConnect(pcon);
121: SSFREE (ss);
122:
123: bzero ((char *) &ref, sizeof ref);
124: (void) SConnResponse (ss -> ss_sd, &ref, NULLSA, result, 0, 0,
125: SERIAL_NONE, NULLCP, 0, si);
126: return rtsaplose (rti, result2, NULLCP, NULLCP);
127: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.