~ubuntu-branches/ubuntu/hardy/sudo/hardy-security

« back to all changes in this revision

Viewing changes to interfaces.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-12-04 18:07:22 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071204180722-5110xr2fnej2h8ko
Tags: 1.6.9p9-1ubuntu1
* Merge with Debian unstable. Remaining Ubuntu changes:
  - debian/prerm: Abort package removal if there is no root password.
    (Debian #451241).
  - debian/rules: Disable lecture, enable tty_tickets by default. (Ubuntu
    specific)
  - Add debian/sudo_root.8: Explanation of root handling through sudo.
    Install it in debian/rules. (Ubuntu specific)
  - sudo.c: If the user successfully authenticated and he is in the 'admin'
    group, then create a stamp ~/.sudo_as_admin_successful. Our default bash
    profile checks for this and displays a short intro about sudo if the
    flag is not present. (Ubuntu specific)
* sudo.c, parse.c: Apply a change that was missing from the older upstream
  tarball that fixes the upstream solution of "SETENV is implicit for ALL".
  We do not want to deviate our orig.tar.gz from Debian's, though.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
/*
22
 
 * Supress a warning w/ gcc on Digital UN*X.
 
22
 * Suppress a warning w/ gcc on Digital UN*X.
23
23
 * The system headers should really do this....
24
24
 */
25
25
#if defined(__osf__) && !defined(__cplusplus)
89
89
#include "interfaces.h"
90
90
 
91
91
#ifndef lint
92
 
__unused static const char rcsid[] = "$Sudo: interfaces.c,v 1.72.2.6 2007/08/14 15:19:25 millert Exp $";
 
92
__unused static const char rcsid[] = "$Sudo: interfaces.c,v 1.72.2.8 2007/11/27 17:06:53 millert Exp $";
93
93
#endif /* lint */
94
94
 
95
95
 
104
104
{
105
105
    struct ifaddrs *ifa, *ifaddrs;
106
106
    struct sockaddr_in *sin;
107
 
#ifdef AF_INET6
 
107
#ifdef HAVE_IN6_ADDR
108
108
    struct sockaddr_in6 *sin6;
109
109
#endif
110
110
    int i;
121
121
 
122
122
        switch(ifa->ifa_addr->sa_family) {
123
123
            case AF_INET:
124
 
#ifdef AF_INET6
 
124
#ifdef HAVE_IN6_ADDR
125
125
            case AF_INET6:
126
126
#endif
127
127
                num_interfaces++;
151
151
                interfaces[i].family = AF_INET;
152
152
                i++;
153
153
                break;
154
 
#ifdef AF_INET6
 
154
#ifdef HAVE_IN6_ADDR
155
155
            case AF_INET6:
156
156
                sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
157
157
                memcpy(&interfaces[i].addr, &sin6->sin6_addr,
162
162
                interfaces[i].family = AF_INET6;
163
163
                i++;
164
164
                break;
165
 
#endif /* AF_INET6 */
 
165
#endif /* HAVE_IN6_ADDR */
166
166
        }
167
167
    }
168
168
#ifdef HAVE_FREEIFADDRS
325
325
dump_interfaces()
326
326
{
327
327
    int i;
328
 
#ifdef AF_INET6
 
328
#ifdef HAVE_IN6_ADDR
329
329
    char addrbuf[INET6_ADDRSTRLEN], maskbuf[INET6_ADDRSTRLEN];
330
330
#endif
331
331
 
336
336
                printf("\t%s / ", inet_ntoa(interfaces[i].addr.ip4));
337
337
                puts(inet_ntoa(interfaces[i].netmask.ip4));
338
338
                break;
339
 
#ifdef AF_INET6
 
339
#ifdef HAVE_IN6_ADDR
340
340
            case AF_INET6:
341
341
                inet_ntop(AF_INET6, &interfaces[i].addr.ip6,
342
342
                    addrbuf, sizeof(addrbuf));
344
344
                    maskbuf, sizeof(maskbuf));
345
345
                printf("\t%s / %s\n", addrbuf, maskbuf);
346
346
                break;
347
 
#endif /* AF_INET6 */
 
347
#endif /* HAVE_IN6_ADDR */
348
348
        }
349
349
    }
350
350
}