MCPcopy Create free account
hub / github.com/F-Stack/f-stack / login_ttyok

Function login_ttyok

tools/libutil/login_ok.c:127–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 */
126
127int
128login_ttyok(login_cap_t *lc, const char *tty, const char *allowcap,
129 const char *denycap)
130{
131 int rc = 1;
132
133 if (lc != NULL && tty != NULL && *tty != '\0') {
134 struct ttyent *te;
135 char *grp;
136 const char **ttl;
137
138 te = getttynam(tty); /* Need group name */
139 grp = te ? te->ty_group : NULL;
140 ttl = login_getcaplist(lc, allowcap, NULL);
141
142 if (ttl != NULL && !login_str2inlist(ttl, tty, grp, 0))
143 rc = 0; /* tty or ttygroup not in allow list */
144 else {
145
146 ttl = login_getcaplist(lc, denycap, NULL);
147 if (ttl != NULL && login_str2inlist(ttl, tty, grp, 0))
148 rc = 0; /* tty or ttygroup in deny list */
149 }
150 }
151
152 return rc;
153}
154
155
156/*

Callers 1

auth_ttyokFunction · 0.85

Calls 2

login_getcaplistFunction · 0.85
login_str2inlistFunction · 0.85

Tested by

no test coverage detected