diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2010-07-31 09:33:10 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2010-07-31 09:33:10 +0000 |
commit | 16a93843430b9a6fb01472fb6dc492f6b0e84aa4 (patch) | |
tree | 2bc8236d1200db49ddd3b8a7188044e0fae33d15 /usr.sbin | |
parent | 89e1017e592e46c056bcd0a0da9eec6af024ef55 (diff) |
delete IIJ local functionalities.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/npppd/npppd/npppd.c | 18 | ||||
-rw-r--r-- | usr.sbin/npppd/npppd/npppd_ctl.c | 72 | ||||
-rw-r--r-- | usr.sbin/npppd/npppd/ppp.c | 28 | ||||
-rw-r--r-- | usr.sbin/npppd/npppd/ppp.h | 10 | ||||
-rw-r--r-- | usr.sbin/npppd/npppdctl/npppdctl.c | 70 |
5 files changed, 14 insertions, 184 deletions
diff --git a/usr.sbin/npppd/npppd/npppd.c b/usr.sbin/npppd/npppd/npppd.c index 16765487d5e..f7abeb2aa3f 100644 --- a/usr.sbin/npppd/npppd/npppd.c +++ b/usr.sbin/npppd/npppd/npppd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $OpenBSD: npppd.c,v 1.6 2010/07/31 09:33:09 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -29,7 +29,7 @@ * Next pppd(nppd). This file provides a npppd daemon process and operations * for npppd instance. * @author Yasuoka Masahiko - * $Id: npppd.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ + * $Id: npppd.c,v 1.6 2010/07/31 09:33:09 yasuoka Exp $ */ #include <sys/cdefs.h> #include "version.h" @@ -85,10 +85,6 @@ __COPYRIGHT( #include "net_utils.h" #include "time_utils.h" -#ifdef USE_NPPPD_LINKID -#include "linkid.h" -#endif - #ifdef USE_NPPPD_ARP #include "npppd_arp.h" #endif @@ -382,9 +378,6 @@ npppd_init(npppd *_this, const char *config_file) fprintf(pidfp, "%u\n", _this->pid); fclose(pidfp); pidfp = NULL; -#ifdef USE_NPPPD_LINKID - linkid_sock_init(); -#endif #ifdef USE_NPPPD_ARP arp_set_strictintfnetwork(npppd_config_str_equali(_this, "arpd.strictintfnetwork", "true", ARPD_STRICTINTFNETWORK_DEFAULT)); if (npppd_config_str_equali(_this, "arpd.enabled", "true", ARPD_DEFAULT) == 1) @@ -425,9 +418,6 @@ npppd_stop(npppd *_this) #ifdef USE_NPPPD_NPPPD_CTL npppd_ctl_stop(&_this->ctl); #endif -#ifdef USE_NPPPD_LINKID - linkid_sock_fini(); -#endif #ifdef USE_NPPPD_ARP arp_sock_fini(); #endif @@ -1265,10 +1255,6 @@ npppd_release_ip(npppd *_this, npppd_ppp *ppp) if (!ppp_ip_assigned(ppp)) return; -#ifdef USE_NPPPD_LINKID - linkid_purge(ppp->ppp_framed_ip_address); -#endif - npppd_set_ip_enabled(_this, ppp, 0); npppd_pool_release_ip(ppp->assigned_pool, ppp); ppp->assigned_pool = NULL; diff --git a/usr.sbin/npppd/npppd/npppd_ctl.c b/usr.sbin/npppd/npppd/npppd_ctl.c index 0f89a200d79..f0087582bc9 100644 --- a/usr.sbin/npppd/npppd/npppd_ctl.c +++ b/usr.sbin/npppd/npppd/npppd_ctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppd_ctl.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $OpenBSD: npppd_ctl.c,v 1.6 2010/07/31 09:33:09 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -30,7 +30,7 @@ * This file provides to open UNIX domain socket which located in * /var/run/npppd_ctl and accept commmands from the npppdctl command. */ -/* $Id: npppd_ctl.c,v 1.5 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $Id: npppd_ctl.c,v 1.6 2010/07/31 09:33:09 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -357,74 +357,6 @@ user_end: } break; } - /* - * related to client authentication - */ - case NPPPD_CTL_CMD_TERMID_SET_AUTH: { -#ifndef NPPPD_USE_CLIENT_AUTH - npppd_ctl_log(_this, LOG_ERR, - "NPPPD_CTL_CMD_TERMID_SET_AUTH is requested, but " - "the terminal authentication is disabled."); - goto fail; -#else - struct npppd_ctl_termid_set_auth_request *req; - npppd_ppp *ppp; - - req = (struct npppd_ctl_termid_set_auth_request *)pkt; - if (pktlen < sizeof(struct npppd_ctl_termid_set_auth_request)) { - npppd_ctl_log(_this, LOG_ERR, - "NPPPD_CTL_CMD_TERMID_SET_AUTH is requested, but " - "the request is invalid."); - goto fail; - } - - ppp = NULL; - - switch (req->ppp_key_type) { - case NPPPD_CTL_PPP_ID: - if ((ppp = npppd_get_ppp_by_id(npppd_get_npppd(), - req->ppp_key.id)) == NULL) { - npppd_ctl_log(_this, LOG_ERR, - "NPPPD_CTL_CMD_TERMID_SET_AUTH is " - "requested, but the requested ppp(id=%d) " - "is not found.", req->ppp_key.id); - goto fail; - } - - break; - case NPPPD_CTL_PPP_FRAMED_IP_ADDRESS: - if ((ppp = npppd_get_ppp_by_ip(npppd_get_npppd(), - req->ppp_key.framed_ip_address)) == NULL) { - npppd_ctl_log(_this, LOG_ERR, - "NPPPD_CTL_CMD_TERMID_SET_AUTH is " - "requested, but the requested ppp(ip=%s) " - "is not found.", - inet_ntoa(req->ppp_key.framed_ip_address)); - goto fail; - } - break; - default: - npppd_ctl_log(_this, LOG_ERR, - "NPPPD_CTL_CMD_TERMID_SET_AUTH is requested, but " - "the ppp_key_type is invalid."); - goto fail; - } - NPPPD_CTL_ASSERT(ppp != NULL); - - ppp_set_client_auth_id(ppp, req->authid); - strlcpy(respbuf, - "Set the client authentication information successfully.", - sizeof(respbuf)); - - if (sendto(_this->sock, respbuf, strlen(respbuf), 0, peer, - peer->sa_len) < 0) { - npppd_ctl_log(_this, LOG_ERR, - "sendto() failed in %s: %m", __func__); - - } -#endif - break; - } case NPPPD_CTL_CMD_RESET_ROUTING_TABLE: { if (npppd_reset_routing_table(_this->npppd, 0) == 0) diff --git a/usr.sbin/npppd/npppd/ppp.c b/usr.sbin/npppd/npppd/ppp.c index 53c79602d1e..69da34d5dee 100644 --- a/usr.sbin/npppd/npppd/ppp.c +++ b/usr.sbin/npppd/npppd/ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $OpenBSD: ppp.c,v 1.5 2010/07/31 09:33:09 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: ppp.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $Id: ppp.c,v 1.5 2010/07/31 09:33:09 yasuoka Exp $ */ /**@file * This file provides PPP(Point-to-Point Protocol, RFC 1661) and * {@link :: _npppd_ppp PPP instance} related functions. @@ -1086,27 +1086,3 @@ ppp_on_network_pipex(npppd_ppp *_this) /* else wait CCP or IPCP */ } #endif - -#ifdef NPPPD_USE_CLIENT_AUTH -#ifdef USE_NPPPD_LINKID -#include "linkid.h" -#endif -/** Set client authentication Id */ -void -ppp_set_client_auth_id(npppd_ppp *_this, const char *client_auth_id) -{ - PPP_ASSERT(_this != NULL); - PPP_ASSERT(client_auth_id != NULL); - PPP_ASSERT(strlen(client_auth_id) <= NPPPD_CLIENT_AUTH_ID_MAXLEN); - - strlcpy(_this->client_auth_id, client_auth_id, - sizeof(_this->client_auth_id)); - _this->has_client_auth_id = 1; -#ifdef USE_NPPPD_LINKID - linkid_purge(_this->ppp_framed_ip_address); -#endif - ppp_log(_this, LOG_NOTICE, - "Set client authentication id successfully. linkid=\"%s\" client_auth_id=%s", - _this->username, client_auth_id); -} -#endif diff --git a/usr.sbin/npppd/npppd/ppp.h b/usr.sbin/npppd/npppd/ppp.h index 68209a9ffff..53ea82fb0cf 100644 --- a/usr.sbin/npppd/npppd/ppp.h +++ b/usr.sbin/npppd/npppd/ppp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp.h,v 1.3 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $OpenBSD: ppp.h,v 1.4 2010/07/31 09:33:09 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -558,12 +558,7 @@ struct _npppd_ppp { */ logged_no_address:1, logged_rcvd:5; -#ifdef NPPPD_USE_CLIENT_AUTH -/** Length of client authentication ID */ -#define NPPPD_CLIENT_AUTH_ID_MAXLEN 32 - char client_auth_id[NPPPD_CLIENT_AUTH_ID_MAXLEN + 1]; - int has_client_auth_id; -#endif + /* * Statistical informations */ @@ -772,7 +767,6 @@ void ppp_reset_idle_timeout(npppd_ppp *); void ppp_process_radius_framed_ip (npppd_ppp *, RADIUS_PACKET *); int ppp_set_radius_attrs_for_authreq (npppd_ppp *, radius_req_setting *, RADIUS_PACKET *); #endif -void ppp_set_client_auth_id(npppd_ppp *, const char *); void ccp_init (ccp *, npppd_ppp *); void ipcp_init (ipcp *, npppd_ppp *); diff --git a/usr.sbin/npppd/npppdctl/npppdctl.c b/usr.sbin/npppd/npppdctl/npppdctl.c index 14459362d8d..51472cd6e21 100644 --- a/usr.sbin/npppd/npppdctl/npppdctl.c +++ b/usr.sbin/npppd/npppdctl/npppdctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppdctl.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $OpenBSD: npppdctl.c,v 1.5 2010/07/31 09:33:09 yasuoka Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Id: npppdctl.c,v 1.4 2010/07/02 21:20:57 yasuoka Exp $ */ +/* $Id: npppdctl.c,v 1.5 2010/07/31 09:33:09 yasuoka Exp $ */ #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -82,7 +82,6 @@ static void on_exit (void); static void npppd_who (int); static void npppd_disconnect (const char *); static const char *eat_null (const char *); -static void npppd_ctl_termid_authen(const char *, const char *); static void npppd_ctl_common(int); static void print_who(struct npppd_who *); static void print_stat(struct npppd_who *); @@ -96,10 +95,8 @@ usage(void) fprintf(stderr, "usage: %s [-slnuh] [-d ppp_user] [-r rcvbuf_sz] [-p npppd_ctl_path]\n" - " %s -c [-r rcvbuf_sz] {ppp_id | ip} auth_id\n" "usage: %s -R\n" "\t-R: Reset the routing table.\n" - "\t-c: Set the client auth's auth-id.\n" "\t-d: Disconnect specified user.\n" "\t-h: Show this usage.\n" "\t-l: Use long line to display information.\n" @@ -121,7 +118,7 @@ on_signal(int notused) int main(int argc, char *argv[]) { - int ch, sflag, fdgramsock, cflag, rtflag; + int ch, sflag, fdgramsock, rtflag; const char *path = DEFAULT_NPPPD_CTL_SOCK_PATH; const char *disconn; struct sockaddr_un sun; @@ -130,8 +127,8 @@ main(int argc, char *argv[]) progname = basename(argv[0]); disconn = NULL; - sflag = cflag = rtflag = 0; - while ((ch = getopt(argc, argv, "lcd:sunhp:r:R")) != -1) { + sflag = rtflag = 0; + while ((ch = getopt(argc, argv, "ld:sunhp:r:R")) != -1) { switch (ch) { case 'n': nflag = 1; @@ -145,9 +142,6 @@ main(int argc, char *argv[]) case 'u': uflag = 1; break; - case 'c': - cflag = 1; - break; case 'l': lflag = 1; break; @@ -221,13 +215,7 @@ main(int argc, char *argv[]) npppd_who(1); else if (rtflag) npppd_ctl_common(NPPPD_CTL_CMD_RESET_ROUTING_TABLE); - else if (cflag > 0) { - if (argc < 2) { - usage(); - exit(1); - } - npppd_ctl_termid_authen(argv[0], argv[1]); - } else + else npppd_who(0); close(sock); @@ -406,52 +394,6 @@ eat_null(const char *str) } static void -npppd_ctl_termid_authen(const char *ppp_key, const char *authid) -{ - int sz; - char *ep; - long lval; - struct npppd_ctl_termid_set_auth_request req = { - .command = NPPPD_CTL_CMD_TERMID_SET_AUTH, - .reserved = 0, - }; - u_char buf[BUFSIZ]; - struct in_addr ip4; - - if (inet_pton(AF_INET, ppp_key, &ip4) == 1) { - req.ppp_key_type = NPPPD_CTL_PPP_FRAMED_IP_ADDRESS; - req.ppp_key.framed_ip_address.s_addr = ip4.s_addr; - } else { - errno = 0; - lval = strtol(ppp_key, &ep, 10); - if (ppp_key[0] == '\0' || *ep != '\0') { - fprintf(stderr, "not a number: %s\n", ppp_key); - exit(1); - } - if ((errno == ERANGE && (lval == LONG_MAX|| lval == LONG_MIN))|| - lval > UINT_MAX) { - fprintf(stderr, "out of range: %s\n", - ppp_key); - exit(1); - } - req.ppp_key_type = NPPPD_CTL_PPP_ID; - req.ppp_key.id = lval; - } - strlcpy(req.authid, authid, sizeof(req.authid)); - - if (sendto(sock, &req, sizeof(req), 0, (struct sockaddr *)&peersock, - sizeof(peersock)) < 0) { - err(1 ,"sendto() failed"); - } - - if ((sz = recv(sock, buf, sizeof(buf), 0)) <= 0) - err(1, "recv"); - buf[sz] = '\0'; - - printf("%s\n", buf); -} - -static void npppd_ctl_common(int command) { int sz; |