=== modified file 'TODO' --- TODO 2008-08-10 20:22:27 +0000 +++ TODO 2008-08-11 07:41:40 +0000 @@ -87,6 +87,7 @@ does not. See also [[http://sources.redhat.com/ml/libc-alpha/2003-05/msg00251.html][Marcus Brinkmann: Re: getpass obsolete?]] and [[http://article.gmane.org/gmane.comp.lib.glibc.alpha/4906][Petter Reinholdtsen: Re: getpass obsolete?]], and especially also [[http://www.steve.org.uk/Reference/Unix/faq_4.html#SEC48][Unix Programming FAQ 3.1 How can I make my program not echo input?]] +** Replace completely with "/lib/cryptsetup/askpass"? * Mandos (server) ** [#A] Command man page: man8/mandos.8 @@ -124,6 +125,8 @@ [[info:standards:Option%20Table][Table of Long Options]] ** Implement --socket [[info:standards:Option%20Table][Table of Long Options]] +** Date+time on console log messages + Is this the default? * Mandos-tools/utilities All of this probably using D-Bus @@ -141,7 +144,7 @@ * [#A] Package ** /etc/bash_completion.d/mandos -** /etc/initramfs-tools/hooks/mandos +** /usr/share/initramfs-tools/hooks/mandos [[file:/usr/share/doc/initramfs-tools/examples/example_hook][Example initramfs-tools hook script]] *** Create GPG key ring files in initrd ** unperish === modified file 'clients.conf' --- clients.conf 2008-08-09 01:39:09 +0000 +++ clients.conf 2008-08-10 20:35:01 +0000 @@ -18,10 +18,10 @@ ;#### -;# Example client named "foo" +;# Example client ;[foo] ; -;# OpenPGP key fingerprint for "foo" +;# OpenPGP key fingerprint ;fingerprint = 7788 2722 5BA7 DE53 9C5A 7CFA 59CF F7CD BD9A 5920 ; ;# This is base64-encoded binary data. It will be decoded and sent to === modified file 'mandos-client.c' --- mandos-client.c 2008-08-10 20:22:27 +0000 +++ mandos-client.c 2008-08-11 07:41:40 +0000 @@ -171,8 +171,11 @@ } bool print_out_password(const char *buffer, size_t length){ - size_t ret; - for(size_t written = 0; written < length; written += ret){ + ssize_t ret; + if(length>0 and buffer[length-1] == '\n'){ + length--; + } + for(size_t written = 0; written < length; written += (size_t)ret){ ret = TEMP_FAILURE_RETRY(write(STDOUT_FILENO, buffer + written, length - written)); if(ret < 0){ @@ -304,7 +307,7 @@ ret = argp_parse (&argp, argc, argv, 0, 0, &plugin_list); if (ret == ARGP_ERR_UNKNOWN){ - fprintf(stderr, "Unkown error while parsing arguments\n"); + fprintf(stderr, "Unknown error while parsing arguments\n"); exitstatus = EXIT_FAILURE; goto end; } @@ -341,7 +344,7 @@ } ret = argp_parse (&argp, new_argc, plus_argv, 0, 0, &plugin_list); if (ret == ARGP_ERR_UNKNOWN){ - fprintf(stderr, "Unkown error while parsing arguments\n"); + fprintf(stderr, "Unknown error while parsing arguments\n"); exitstatus = EXIT_FAILURE; goto end; } @@ -716,11 +719,6 @@ exitstatus = EXIT_FAILURE; goto end; } - bret = print_out_password("\n", 1); - if(not bret){ - perror("print_out_password"); - exitstatus = EXIT_FAILURE; - } } end: === modified file 'plugins.d/password-request.c' --- plugins.d/password-request.c 2008-08-10 03:32:42 +0000 +++ plugins.d/password-request.c 2008-08-11 16:07:39 +0000 @@ -44,8 +44,6 @@ #include /* memset(), strcmp(), strlen(), strerror(), memcpy(), strcpy() */ #include /* ioctl */ -#include /* ifreq, SIOCGIFFLAGS, SIOCSIFFLAGS, - IFF_UP */ #include /* socket(), inet_pton(), sockaddr, sockaddr_in6, PF_INET6, SOCK_STREAM, INET6_ADDRSTRLEN, @@ -487,7 +485,7 @@ fprintf(stderr, "Bad address: %s\n", ip); return -1; } - to.in6.sin6_port = htons(port); /* Spurious warning */ + to.in6.sin6_port = htons(port); /* Spurious warning */ to.in6.sin6_scope_id = (uint32_t)if_index; @@ -867,7 +865,7 @@ " passwords from mandos server" }; ret = argp_parse (&argp, argc, argv, 0, 0, NULL); if (ret == ARGP_ERR_UNKNOWN){ - fprintf(stderr, "Unkown error while parsing arguments\n"); + fprintf(stderr, "Unknown error while parsing arguments\n"); exitcode = EXIT_FAILURE; goto end; } @@ -893,10 +891,37 @@ } else { gnutls_initalized = true; } - + + /* If the interface is down, bring it up */ + { + sd = socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP); + if(sd < 0) { + perror("socket"); + exitcode = EXIT_FAILURE; + goto end; + } + strcpy(network.ifr_name, interface); /* Spurious warning */ + ret = ioctl(sd, SIOCGIFFLAGS, &network); + if(ret == -1){ + perror("ioctl SIOCGIFFLAGS"); + exitcode = EXIT_FAILURE; + goto end; + } + if((network.ifr_flags & IFF_UP) == 0){ + network.ifr_flags |= IFF_UP; + ret = ioctl(sd, SIOCSIFFLAGS, &network); + if(ret == -1){ + perror("ioctl SIOCSIFFLAGS"); + exitcode = EXIT_FAILURE; + goto end; + } + } + close(sd); + } + uid = getuid(); gid = getgid(); - + ret = setuid(uid); if (ret == -1){ perror("setuid"); @@ -940,33 +965,6 @@ goto end; } - /* If the interface is down, bring it up */ - { - sd = socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP); - if(sd < 0) { - perror("socket"); - exitcode = EXIT_FAILURE; - goto end; - } - strcpy(network.ifr_name, interface); /* Spurious warning */ - ret = ioctl(sd, SIOCGIFFLAGS, &network); - if(ret == -1){ - perror("ioctl SIOCGIFFLAGS"); - exitcode = EXIT_FAILURE; - goto end; - } - if((network.ifr_flags & IFF_UP) == 0){ - network.ifr_flags |= IFF_UP; - ret = ioctl(sd, SIOCSIFFLAGS, &network); - if(ret == -1){ - perror("ioctl SIOCSIFFLAGS"); - exitcode = EXIT_FAILURE; - goto end; - } - } - close(sd); - } - if (not debug){ avahi_set_log_function(empty_log); }