kswitch.c (226031) | kswitch.c (226128) |
---|---|
1/* 2 * Copyright (c) 2008 - 2010 Kungliga Tekniska H��gskolan 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 61 unchanged lines hidden (view full) --- 70 krb5_cc_cache_cursor cursor; 71 krb5_ccache *ids = NULL; 72 size_t i, len = 0; 73 char *name; 74 rtbl_t ct; 75 76 ct = rtbl_create(); 77 | 1/* 2 * Copyright (c) 2008 - 2010 Kungliga Tekniska H��gskolan 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 61 unchanged lines hidden (view full) --- 70 krb5_cc_cache_cursor cursor; 71 krb5_ccache *ids = NULL; 72 size_t i, len = 0; 73 char *name; 74 rtbl_t ct; 75 76 ct = rtbl_create(); 77 |
78 rtbl_add_column(ct, "", 0); 79 rtbl_add_column(ct, "Principal", 0); 80 rtbl_set_column_prefix(ct, "Principal", " "); | 78 rtbl_add_column_by_id(ct, 0, "#", 0); 79 rtbl_add_column_by_id(ct, 1, "Principal", 0); 80 rtbl_set_column_affix_by_id(ct, 1, " ", ""); 81 rtbl_add_column_by_id(ct, 2, "Type", 0); 82 rtbl_set_column_affix_by_id(ct, 2, " ", ""); |
81 82 ret = krb5_cc_cache_get_first(kcc_context, NULL, &cursor); 83 if (ret) 84 krb5_err(kcc_context, 1, ret, "krb5_cc_cache_get_first"); 85 86 while (krb5_cc_cache_next(kcc_context, cursor, &id) == 0) { 87 krb5_principal p; 88 char num[10]; 89 90 ret = krb5_cc_get_principal(kcc_context, id, &p); 91 if (ret) 92 continue; 93 94 ret = krb5_unparse_name(kcc_context, p, &name); 95 krb5_free_principal(kcc_context, p); 96 97 snprintf(num, sizeof(num), "%d", (int)(len + 1)); | 83 84 ret = krb5_cc_cache_get_first(kcc_context, NULL, &cursor); 85 if (ret) 86 krb5_err(kcc_context, 1, ret, "krb5_cc_cache_get_first"); 87 88 while (krb5_cc_cache_next(kcc_context, cursor, &id) == 0) { 89 krb5_principal p; 90 char num[10]; 91 92 ret = krb5_cc_get_principal(kcc_context, id, &p); 93 if (ret) 94 continue; 95 96 ret = krb5_unparse_name(kcc_context, p, &name); 97 krb5_free_principal(kcc_context, p); 98 99 snprintf(num, sizeof(num), "%d", (int)(len + 1)); |
98 rtbl_add_column_entry(ct, "", num); 99 rtbl_add_column_entry(ct, "Principal", name); | 100 rtbl_add_column_entry_by_id(ct, 0, num); 101 rtbl_add_column_entry_by_id(ct, 1, name); 102 rtbl_add_column_entry_by_id(ct, 2, krb5_cc_get_type(kcc_context, id)); |
100 free(name); 101 102 ids = erealloc(ids, (len + 1) * sizeof(ids[0])); 103 ids[len] = id; 104 len++; 105 } 106 krb5_cc_cache_end_seq_get(kcc_context, cursor); 107 --- 62 unchanged lines hidden --- | 103 free(name); 104 105 ids = erealloc(ids, (len + 1) * sizeof(ids[0])); 106 ids[len] = id; 107 len++; 108 } 109 krb5_cc_cache_end_seq_get(kcc_context, cursor); 110 --- 62 unchanged lines hidden --- |