-/* $OpenBSD: ypserv_proc.c,v 1.10 1997/03/30 20:51:21 maja Exp $ */
+/* $OpenBSD: ypserv_proc.c,v 1.11 1997/04/12 00:12:57 deraadt Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.10 1997/03/30 20:51:21 maja Exp $";
+static char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.11 1997/04/12 00:12:57 deraadt Exp $";
#endif
#include <rpc/rpc.h>
static char domain_path[MAXPATHLEN];
struct stat finfo;
+ if (strchr(*argp, '/'))
+ goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
(finfo.st_mode & S_IFDIR));
TORF(ok), *argp, TORF(result));
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
static char domain_path[MAXPATHLEN];
struct stat finfo;
+ if (strchr(*argp, '/'))
+ goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
(finfo.st_mode & S_IFDIR));
*argp, TORF(result));
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure = ypdb_secure(argp->domain,argp->map);
+ if (strchr(argp->domain, '/'))
+ goto bail;
YPLOG(
"match_2: caller=[%s].%d, auth_ok=%s, secure=%s, domain=%s, map=%s, key=%.*s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
argp->domain, argp->map, argp->key.keydat_len, argp->key.keydat_val);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure = ypdb_secure(argp->domain,argp->map);
+ if (strchr(argp->domain, '/'))
+ goto bail;
YPLOG( "first_2: caller=[%s].%d, auth_ok=%s, secure=%s, domain=%s, map=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
TORF(ok), TORF(secure),
argp->domain, argp->map);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure = ypdb_secure(argp->domain,argp->map);
+ if (strchr(argp->domain, '/'))
+ goto bail;
YPLOG(
"next_2: caller=[%s].%d, auth_ok=%s, secure=%s, domain=%s, map=%s, key=%.*s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
argp->domain, argp->map, argp->key.keydat_len, argp->key.keydat_val);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
char *ipadd;
bzero((char *)&res, sizeof(res));
-
+
YPLOG("xfr_2: caller=[%s].%d, auth_ok=%s, domain=%s, tid=%d, prog=%d",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port), TORF(ok),
argp->map_parms.domain, argp->transid, argp->prog);
YPLOG(" ipadd=%s, port=%d, map=%s", inet_ntoa(caller->sin_addr),
argp->port, argp->map_parms.map);
- if (ntohs(caller->sin_port) >= IPPORT_RESERVED)
- ok = FALSE;
-
- if (!ok) {
+ if (strchr(argp->map_parms.domain, '/') ||
+ ntohs(caller->sin_port) >= IPPORT_RESERVED) {
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
pid = vfork();
-
if (pid == -1) {
svcerr_systemerr(rqstp->rq_xprt);
return(NULL);
-
}
if (pid == 0) {
int ok = acl_check_host(&caller->sin_addr);
int secure = ypdb_secure(argp->domain,argp->map);
+ if (strchr(argp->domain, '/'))
+ goto bail;
YPLOG( "all_2: caller=[%s].%d, auth_ok=%s, secure=%s, domain=%s, map=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
TORF(ok), TORF(secure), argp->domain, argp->map);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure = ypdb_secure(argp->domain,argp->map);
+ if (strchr(argp->domain, '/'))
+ goto bail;
YPLOG( "master_2: caller=[%s].%d, auth_ok=%s, secure=%s, domain=%s, map=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
TORF(ok), TORF(secure), argp->domain, argp->map);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure = ypdb_secure(argp->domain,argp->map);
+ if (strchr(argp->domain, '/'))
+ goto bail;
YPLOG( "order_2: caller=[%s].%d, auth_ok=%s, secure=%s, domain=%s, map=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port),
TORF(ok), TORF(secure), argp->domain, argp->map);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
struct ypmaplist *m;
char *map_name;
+ if (strchr(*argp, '/'))
+ goto bail;
YPLOG("maplist_2: caller=[%s].%d, auth_ok=%s, domain=%s",
inet_ntoa(caller->sin_addr), ntohs(caller->sin_port), TORF(ok),
*argp);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
static char domain_path[MAXPATHLEN];
struct stat finfo;
+ if (strchr(*argp, '/'))
+ goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
(finfo.st_mode & S_IFDIR));
TORF(ok), *argp, TORF(result));
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
static char domain_path[MAXPATHLEN];
struct stat finfo;
+ if (strchr(*argp, '/'))
+ goto bail;
snprintf(domain_path, sizeof(domain_path), "%s/%s", YP_DB_PATH, *argp);
result = (bool_t) ((stat(domain_path, &finfo) == 0) &&
(finfo.st_mode & S_IFDIR));
*argp, TORF(result));
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure;
+ if (strchr(argp->ypmatch_req_domain, '/'))
+ goto bail;
res.yp_resptype = YPMATCH_RESPTYPE;
res.ypmatch_resp_valptr = "";
res.ypmatch_resp_valsize = 0;
argp->ypmatch_req_keysize, argp->ypmatch_req_keyptr);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure;
+ if (strchr(argp->ypfirst_req_domain, '/'))
+ goto bail;
res.yp_resptype = YPFIRST_RESPTYPE;
res.ypfirst_resp_valptr = res.ypfirst_resp_keyptr = "";
res.ypfirst_resp_valsize = res.ypfirst_resp_keysize = 0;
argp->ypfirst_req_domain, argp->ypfirst_req_map);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure;
+ if (strchr(argp->ypnext_req_domain, '/'))
+ goto bail;
res.yp_resptype = YPNEXT_RESPTYPE;
res.ypnext_resp_valptr = res.ypnext_resp_keyptr = "";
res.ypnext_resp_valsize = res.ypnext_resp_keysize = 0;
argp->ypnext_req_keysize, argp->ypnext_req_keyptr);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
int ok = acl_check_host(&caller->sin_addr);
int secure;
+ if (strchr(argp->yppoll_req_domain, '/'))
+ goto bail;
res.yp_resptype = YPPOLL_RESPTYPE;
res.yppoll_resp_domain = argp->yppoll_req_domain;
res.yppoll_resp_map = argp->yppoll_req_map;
argp->yppoll_req_domain, argp->yppoll_req_map);
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
pid_t pid;
char yppush_proc[] = YPPUSH_PROC;
+ if (strchr(argp->yppush_req_domain, '/'))
+ goto bail;
if (argp->yp_reqtype != YPPUSH_REQTYPE) {
return(NULL);
}
ok = FALSE;
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
pid_t pid;
char ypxfr_proc[] = YPXFR_PROC;
+ if (strchr(argp->yppull_req_domain, '/'))
+ goto bail;
if (argp->yp_reqtype != YPPULL_REQTYPE) {
return(NULL);
}
ok = FALSE;
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}
pid_t pid;
char ypxfr_proc[] = YPXFR_PROC;
+ if (strchr(argp->ypget_req_domain, '/'))
+ goto bail;
if (argp->yp_reqtype != YPGET_REQTYPE) {
return(NULL);
}
ok = FALSE;
if (!ok) {
+bail:
svcerr_auth(rqstp->rq_xprt, AUTH_FAILED);
return(NULL);
}