~ubuntu-branches/ubuntu/vivid/dropbear/vivid

« back to all changes in this revision

Viewing changes to dbutil.c

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape, Matt Johnston, Gerrit Pape
  • Date: 2011-11-16 12:36:03 UTC
  • mfrom: (1.3.7) (14.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111116123603-fn0vgshz8wibumyo
[ Matt Johnston ]
* new upstream release.
  * Added ALLOW_BLANK_PASSWORD option. Dropbear also now allows public
    key logins to accounts with a blank password. Thanks to Rob
    Landley (closes: #555889).
  * Bind to sockets with IPV6_V6ONLY so that it works properly on
    systems regardless of the system-wide setting (closes: #636696).

[ Gerrit Pape ]
* debian/control: Standards-Version: 3.9.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
#define MAX_FMT 100
58
58
 
59
59
static void generic_dropbear_exit(int exitcode, const char* format, 
60
 
                va_list param);
 
60
                va_list param) ATTRIB_NORETURN;
61
61
static void generic_dropbear_log(int priority, const char* format, 
62
62
                va_list param);
63
63
 
64
 
void (*_dropbear_exit)(int exitcode, const char* format, va_list param) 
 
64
void (*_dropbear_exit)(int exitcode, const char* format, va_list param) ATTRIB_NORETURN
65
65
                                                = generic_dropbear_exit;
66
66
void (*_dropbear_log)(int priority, const char* format, va_list param)
67
67
                                                = generic_dropbear_log;
161
161
        val = 1;
162
162
        setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
163
163
 
164
 
        /* set the TOS bit. note that this will fail for ipv6, I can't find any
165
 
         * equivalent. */
 
164
        /* set the TOS bit for either ipv4 or ipv6 */
166
165
#ifdef IPTOS_LOWDELAY
167
166
        val = IPTOS_LOWDELAY;
 
167
#ifdef IPPROTO_IPV6
 
168
        setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
 
169
#endif
168
170
        setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
169
171
#endif
170
172
 
254
256
                linger.l_linger = 5;
255
257
                setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
256
258
 
 
259
#ifdef IPV6_V6ONLY
 
260
                if (res->ai_family == AF_INET6) {
 
261
                        int on = 1;
 
262
                        if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, 
 
263
                                                &on, sizeof(on)) == -1) {
 
264
                                dropbear_log(LOG_WARNING, "Couldn't set IPV6_V6ONLY");
 
265
                        }
 
266
                }
 
267
#endif
 
268
 
257
269
                set_sock_priority(sock);
258
270
 
259
271
                if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
311
323
        }
312
324
        if (connect(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
313
325
                TRACE(("Failed to connect to '%s' socket", path))
 
326
                m_close(fd);
314
327
                return -1;
315
328
        }
316
329
        return fd;