~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to openbsd-compat/port-aix.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-09-30 23:09:58 UTC
  • mfrom: (1.13.3 upstream) (29 hardy)
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20080930230958-o6vsgn8c4mm959s0
Tags: 1:5.1p1-3
* Remove unnecessary ssh-vulnkey output in non-verbose mode when no
  compromised or unknown keys were found (closes: #496495).
* Configure with --disable-strip; dh_strip will deal with stripping
  binaries and will honour DEB_BUILD_OPTIONS (thanks, Bernhard R. Link;
  closes: #498681).
* Fix handling of zero-length server banners (thanks, Tomas Mraz; closes:
  #497026).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *
3
3
 * Copyright (c) 2001 Gert Doering.  All rights reserved.
4
 
 * Copyright (c) 2003,2004,2005 Darren Tucker.  All rights reserved.
 
4
 * Copyright (c) 2003,2004,2005,2006 Darren Tucker.  All rights reserved.
5
5
 *
6
6
 * Redistribution and use in source and binary forms, with or without
7
7
 * modification, are permitted provided that the following conditions
240
240
 
241
241
        /*
242
242
         * Don't perform checks for root account (PermitRootLogin controls
243
 
         * logins via * ssh) or if running as non-root user (since
 
243
         * logins via ssh) or if running as non-root user (since
244
244
         * loginrestrictions will always fail due to insufficient privilege).
245
245
         */
246
246
        if (pw->pw_uid == 0 || geteuid() != 0) {
394
394
}
395
395
# endif /* AIX_GETNAMEINFO_HACK */
396
396
 
 
397
# if defined(USE_GETGRSET)
 
398
#  include <stdlib.h>
 
399
int
 
400
getgrouplist(const char *user, gid_t pgid, gid_t *groups, int *grpcnt)
 
401
{
 
402
        char *cp, *grplist, *grp;
 
403
        gid_t gid;
 
404
        int ret = 0, ngroups = 0, maxgroups;
 
405
        long l;
 
406
 
 
407
        maxgroups = *grpcnt;
 
408
 
 
409
        if ((cp = grplist = getgrset(user)) == NULL)
 
410
                return -1;
 
411
 
 
412
        /* handle zero-length case */
 
413
        if (maxgroups <= 0) {
 
414
                *grpcnt = 0;
 
415
                return -1;
 
416
        }
 
417
 
 
418
        /* copy primary group */
 
419
        groups[ngroups++] = pgid;
 
420
 
 
421
        /* copy each entry from getgrset into group list */
 
422
        while ((grp = strsep(&grplist, ",")) != NULL) {
 
423
                l = strtol(grp, NULL, 10);
 
424
                if (ngroups >= maxgroups || l == LONG_MIN || l == LONG_MAX) {
 
425
                        ret = -1;
 
426
                        goto out;
 
427
                }
 
428
                gid = (gid_t)l;
 
429
                if (gid == pgid)
 
430
                        continue;       /* we have already added primary gid */
 
431
                groups[ngroups++] = gid;
 
432
        }
 
433
out:
 
434
        free(cp);
 
435
        *grpcnt = ngroups;
 
436
        return ret;
 
437
}
 
438
# endif /* USE_GETGRSET */
 
439
 
397
440
#endif /* _AIX */