From fff4b74db26968bac72ade4bd6c702be7b51ec7a Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 15 May 2012 16:59:00 +0200 Subject: Bye bye Pluto! Charon will take over IKEv1 duties from here. This also removes libfreeswan and whack. --- src/pluto/myid.c | 121 ------------------------------------------------------- 1 file changed, 121 deletions(-) delete mode 100644 src/pluto/myid.c (limited to 'src/pluto/myid.c') diff --git a/src/pluto/myid.c b/src/pluto/myid.c deleted file mode 100644 index c90d14ef8..000000000 --- a/src/pluto/myid.c +++ /dev/null @@ -1,121 +0,0 @@ -/* identity representation, as in IKE ID Payloads (RFC 2407 DOI 4.6.2.1) - * Copyright (C) 1999-2001 D. Hugh Redelmeier - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#include -#include - -#ifndef HOST_NAME_MAX /* POSIX 1003.1-2001 says defines this */ -# define HOST_NAME_MAX 255 /* upper bound, according to SUSv2 */ -#endif - -#include - -#include - -#include "myid.h" -#include "constants.h" -#include "defs.h" -#include "log.h" -#include "connections.h" -#include "packet.h" -#include "whack.h" - -enum myid_state myid_state = MYID_UNKNOWN; - -identification_t *myids[MYID_SPECIFIED+1]; /* %myid */ - -/** - * Fills in myid from environment variable IPSECmyid or defaultrouteaddr - */ -void init_myid(void) -{ - myid_state = MYID_UNKNOWN; - { - enum myid_state s; - - for (s = MYID_UNKNOWN; s <= MYID_SPECIFIED; s++) - { - myids[s] = identification_create_from_string("%any"); - } - } - set_myid(MYID_SPECIFIED, getenv("IPSECmyid")); - set_myid(MYID_IP, getenv("defaultrouteaddr")); - set_myFQDN(); -} - -/** - * Free myid module - */ -void free_myid(void) -{ - enum myid_state s; - - for (s = MYID_UNKNOWN; s <= MYID_SPECIFIED; s++) - { - DESTROY_IF(myids[s]); - } -} - -void set_myid(enum myid_state s, char *idstr) -{ - if (idstr) - { - myids[s]->destroy(myids[s]); - myids[s] = identification_create_from_string(idstr); - if (s == MYID_SPECIFIED) - { - myid_state = MYID_SPECIFIED; - } - } -} - -void set_myFQDN(void) -{ - char FQDN[HOST_NAME_MAX + 1]; - int r = gethostname(FQDN, sizeof(FQDN)); - size_t len; - - if (r != 0) - { - log_errno((e, "gethostname() failed in set_myFQDN")); - } - else - { - FQDN[sizeof(FQDN) - 1] = '\0'; /* insurance */ - len = strlen(FQDN); - - if (len > 0 && FQDN[len-1] == '.') - { - /* nuke trailing . */ - FQDN[len-1] = '\0'; - } - if (!strcaseeq(FQDN, "localhost.localdomain")) - { - myids[MYID_HOSTNAME]->destroy(myids[MYID_HOSTNAME]); - myids[MYID_HOSTNAME] = identification_create_from_string(FQDN); - } - } -} - -void show_myid_status(void) -{ - whack_log(RC_COMMENT, "%%myid = '%Y'", myids[myid_state]); -} - -/* - * Local Variables: - * c-basic-offset:4 - * c-style: pluto - * End: - */ -- cgit v1.2.3