Changeset 8351

Show
Ignore:
Timestamp:
06/01/10 12:36:05 (4 years ago)
Author:
nlmills
Message:

cleaned up admin apps with better error checking for credentials

Location:
branches/cu-security-branch/src
Files:
26 modified

Legend:

Unmodified
Added
Removed
  • branches/cu-security-branch/src/apps/admin/pvfs2-chmod.c

    r8339 r8351  
    9999  } 
    100100 
    101   PVFS_util_gen_credential_defaults(&credentials); 
     101  ret = PVFS_util_gen_credential_defaults(&credentials); 
     102  if (ret < 0) 
     103  { 
     104    PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     105    return -1; 
     106  } 
    102107 
    103108  /* this if-else statement just pulls apart the pathname into its 
  • branches/cu-security-branch/src/apps/admin/pvfs2-chown.c

    r8339 r8351  
    105105  } 
    106106 
    107   PVFS_util_gen_credential_defaults(&credentials); 
     107  ret = PVFS_util_gen_credential_defaults(&credentials); 
     108  if (ret < 0) 
     109  { 
     110    PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     111    return -1; 
     112  } 
    108113 
    109114  /* this if-else statement just pulls apart the pathname into its 
  • branches/cu-security-branch/src/apps/admin/pvfs2-cp.c

    r8339 r8351  
    150150    resolve_filename(&dest, user_opts->destfile); 
    151151 
     152    /* nlmills: TODO: find a better way to handle timeouts */ 
    152153    ret = PVFS_util_gen_credential(NULL, 5*60*60, NULL, &credentials); 
    153154    if (ret < 0) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-drop-caches.c

    r8339 r8351  
    6767    } 
    6868 
    69     PVFS_util_gen_credential_defaults(&creds); 
     69    ret = PVFS_util_gen_credential_defaults(&creds); 
     70    if (ret < 0) 
     71    { 
     72        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     73        return(-1); 
     74    } 
    7075 
    7176    ret = PVFS_mgmt_setparam_all(cur_fs, 
  • branches/cu-security-branch/src/apps/admin/pvfs2-event-mon-example.c

    r8339 r8351  
    7070    } 
    7171 
    72     PVFS_util_gen_credential_defaults(&creds); 
     72    ret = PVFS_util_gen_credential_defaults(&creds); 
     73    if (ret < 0) 
     74    { 
     75        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     76        return -1; 
     77    } 
    7378 
    7479    /* count how many I/O servers we have */ 
  • branches/cu-security-branch/src/apps/admin/pvfs2-fs-dump.c

    r8339 r8351  
    139139    } 
    140140 
     141    /* nlmills: TODO: find a better way to handle credential timeouts */ 
    141142    ret = PVFS_util_gen_credential(NULL, 5*60*60, NULL, &creds); 
    142143    if (ret < 0) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-fsck.c

    r8339 r8351  
    8282    } 
    8383 
     84    /* nlmills: TODO: find a better way to handle credential timeouts */ 
    8485    ret = PVFS_util_gen_credential(NULL, 5*60*60, NULL, &creds); 
    8586    if (ret < 0) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-gencred.c

    r8345 r8351  
    1 /* N.B. root_squash could create problems with this over NFS */ 
    2  
     1/* 
     2 * Copyright 2010 Clemson University and The University of Chicago. 
     3 * 
     4 * See COPYING in top-level directory. 
     5 */ 
    36 
    47#include <stdlib.h> 
     
    276279    } 
    277280     
    278     /* TODO: fall back to getugroups */ 
     281    /* nlmills: TODO: fall back to getugroups */ 
    279282     
    280283    ngroups = sizeof(groups)/sizeof(*groups); 
  • branches/cu-security-branch/src/apps/admin/pvfs2-ln.c

    r8339 r8351  
    8383 
    8484    /* We will re-use the same credentials for each call */ 
    85     PVFS_util_gen_credential_defaults(&credentials); 
     85    ret = PVFS_util_gen_credential_defaults(&credentials); 
     86    if (ret < 0) 
     87    { 
     88        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     89        return(-1); 
     90    } 
    8691 
    8792    ret = make_link(&credentials, 
  • branches/cu-security-branch/src/apps/admin/pvfs2-ls.c

    r8339 r8351  
    394394 
    395395            memset(&getattr_response,0, sizeof(PVFS_sysresp_getattr)); 
    396             PVFS_util_gen_credential_defaults(&credentials); 
     396            ret = PVFS_util_gen_credential_defaults(&credentials); 
     397            if (ret < 0) 
     398            { 
     399                PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     400                return; 
     401            } 
    397402 
    398403            ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT, 
     
    445450 
    446451    memset(&lk_response,0,sizeof(PVFS_sysresp_lookup)); 
    447     PVFS_util_gen_credential_defaults(&credentials); 
     452    ret = PVFS_util_gen_credential_defaults(&credentials); 
     453    if (ret < 0) 
     454    { 
     455        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     456        return -1; 
     457    } 
    448458 
    449459    if (opts->list_recursive || opts->num_starts > 1) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-mkdir.c

    r8339 r8351  
    133133 
    134134    /* We will re-use the same credentials for each call */ 
    135     PVFS_util_gen_credential_defaults(&credentials); 
     135    ret = PVFS_util_gen_credential_defaults(&credentials); 
     136    if (ret < 0) 
     137    { 
     138        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     139        return(-1); 
     140    } 
    136141 
    137142    for(i = 0; i < user_opts.numdirs; i++) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-perf-mon-example.c

    r8339 r8351  
    7979    } 
    8080 
    81     PVFS_util_gen_credential_defaults(&creds); 
     81    /* nlmills: TODO: find a better way to handle credential timeouts */ 
     82    ret = PVFS_util_gen_credential(NULL, 1*60*60, NULL, &creds); 
     83    if (ret < 0) 
     84    { 
     85        PVFS_perror("PVFS_util_gen_credential", ret); 
     86        return(-1); 
     87    } 
    8288 
    8389    /* count how many I/O servers we have */ 
  • branches/cu-security-branch/src/apps/admin/pvfs2-ping.c

    r8339 r8351  
    130130    print_mntent(tab->mntent_array, tab->mntent_count); 
    131131 
    132     PVFS_util_gen_credential_defaults(&creds); 
     132    ret = PVFS_util_gen_credential_defaults(&creds); 
     133    if (ret < 0) 
     134    { 
     135        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     136        return(-1); 
     137    } 
    133138 
    134139    /* dump some key parts of the config file */ 
     
    272277    int tmp; 
    273278  
    274     PVFS_util_gen_credential_defaults(&creds); 
     279    ret = PVFS_util_gen_credential_defaults(&creds); 
     280    if (ret < 0) 
     281    { 
     282        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     283        return ret; 
     284    } 
    275285 
    276286    printf("\n   meta servers:\n"); 
     
    375385    PVFS_BMI_addr_t *addr_array; 
    376386  
    377     PVFS_util_gen_credential_defaults(&creds); 
     387    ret = PVFS_util_gen_credential_defaults(&creds); 
     388    if (ret < 0) 
     389    { 
     390        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     391        return ret; 
     392    } 
    378393 
    379394    printf("\n   meta servers:\n"); 
  • branches/cu-security-branch/src/apps/admin/pvfs2-remove-object.c

    r8339 r8351  
    210210    } 
    211211 
    212     PVFS_util_gen_credential_defaults(&credentials); 
     212    ret = PVFS_util_gen_credential_defaults(&credentials); 
     213    if (ret < 0) 
     214    { 
     215        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     216        return -1; 
     217    } 
    213218 
    214219    if (user_opts->remove_object_only) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-rm.c

    r8339 r8351  
    7474        int tmp_len = 0; 
    7575 
    76         PVFS_util_gen_credential_defaults(&credentials); 
     76        rc = PVFS_util_gen_credential_defaults(&credentials); 
     77        if (rc < 0) 
     78        { 
     79            PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     80            ret = -1; 
     81            break; 
     82        } 
    7783 
    7884        /* Translate path into pvfs2 relative path */ 
  • branches/cu-security-branch/src/apps/admin/pvfs2-set-debugmask.c

    r8339 r8351  
    7171    } 
    7272 
    73     PVFS_util_gen_credential_defaults(&creds); 
     73    ret = PVFS_util_gen_credential_defaults(&creds); 
     74    if (ret < 0) 
     75    { 
     76        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     77        return(-1); 
     78    } 
    7479 
    7580    if (user_opts->single_server) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-set-eventmask.c

    r8339 r8351  
    7070    } 
    7171 
    72     PVFS_util_gen_credential_defaults(&creds); 
     72    ret = PVFS_util_gen_credential_defaults(&creds); 
     73    if (ret < 0) 
     74    { 
     75        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     76        return(-1); 
     77    } 
    7378 
    7479    param_value.type = PVFS_MGMT_PARAM_TYPE_STRING; 
  • branches/cu-security-branch/src/apps/admin/pvfs2-set-mode.c

    r8339 r8351  
    7070    } 
    7171 
    72     PVFS_util_gen_credential_defaults(&creds); 
     72    ret = PVFS_util_gen_credential_defaults(&creds); 
     73    if (ret < 0) 
     74    { 
     75        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     76        return(-1); 
     77    } 
    7378 
    7479    param_value.type = PVFS_MGMT_PARAM_TYPE_UINT64; 
  • branches/cu-security-branch/src/apps/admin/pvfs2-set-sync.c

    r8339 r8351  
    7575    } 
    7676 
    77     PVFS_util_gen_credential_defaults(&creds); 
     77    ret = PVFS_util_gen_credential_defaults(&creds); 
     78    if (ret < 0) 
     79    { 
     80        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     81        return(-1); 
     82    } 
    7883 
    7984    param_value.type = PVFS_MGMT_PARAM_TYPE_UINT64; 
  • branches/cu-security-branch/src/apps/admin/pvfs2-stat.c

    r8339 r8351  
    133133 
    134134   /* We will re-use the same credentials for each call */ 
    135    PVFS_util_gen_credential_defaults(&credentials); 
     135   ret = PVFS_util_gen_credential_defaults(&credentials); 
     136   if (ret < 0) 
     137   { 
     138       PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     139       return(-1); 
     140   } 
    136141 
    137142   for(i = 0; i < user_opts.nNumFiles; i++) 
  • branches/cu-security-branch/src/apps/admin/pvfs2-statfs.c

    r8339 r8351  
    8282    } 
    8383 
    84     PVFS_util_gen_credential_defaults(&creds); 
     84    ret = PVFS_util_gen_credential_defaults(&creds); 
     85    if (ret < 0) 
     86    { 
     87        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     88        return(-1); 
     89    } 
    8590 
    8691    /* gather normal statfs statistics from system interface */ 
  • branches/cu-security-branch/src/apps/admin/pvfs2-touch.c

    r8339 r8351  
    113113        } 
    114114 
    115         PVFS_util_gen_credential_defaults(&credentials); 
     115        ret = PVFS_util_gen_credential_defaults(&credentials); 
     116        if (ret < 0) 
     117        { 
     118            PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     119            ret = -1; 
     120            break; 
     121        } 
    116122 
    117123        memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup)); 
  • branches/cu-security-branch/src/apps/admin/pvfs2-validate.c

    r8339 r8351  
    136136    } 
    137137 
    138     PVFS_util_gen_credential_defaults(&creds); 
     138    ret = PVFS_util_gen_credential_defaults(&creds); 
     139    if (ret < 0) 
     140    { 
     141        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     142        PVFS_sys_finalize(); 
     143        free(fsck_options); 
     144        return -1; 
     145    } 
    139146 
    140147    ret = PVFS_sys_lookup( 
  • branches/cu-security-branch/src/apps/admin/pvfs2-viewdist.c

    r8339 r8351  
    234234    resolve_filename(&src,  user_opts->srcfile); 
    235235 
    236     PVFS_util_gen_credential_defaults(&credentials); 
     236    ret = PVFS_util_gen_credential_defaults(&credentials); 
     237    if (ret < 0) 
     238    { 
     239        PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     240        return(-1); 
     241    } 
    237242 
    238243    ret = generic_open(&src, &credentials); 
  • branches/cu-security-branch/src/apps/admin/pvfs2-xattr.c

    r8339 r8351  
    111111  resolve_filename(&src, user_opts->srcfile); 
    112112 
    113   PVFS_util_gen_credential_defaults(&credentials); 
     113  ret = PVFS_util_gen_credential_defaults(&credentials); 
     114  if (ret < 0) 
     115  { 
     116      PVFS_perror("PVFS_util_gen_credential_defaults", ret); 
     117      return(-1); 
     118  } 
     119 
    114120  ret = generic_open(&src, &credentials); 
    115121  if (ret < 0) 
  • branches/cu-security-branch/src/common/misc/pvfs2-util.c

    r8350 r8351  
    256256                PVFS_credential tmp; 
    257257 
     258                /* nlmills: TODO: secure against buffer overflows in decode */ 
    258259                decode_PVFS_credential(&ptr, &tmp); 
    259260                ret = PINT_copy_credential(&tmp, cred);