~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/util/ss/invocation.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2009-05-07 16:16:34 UTC
  • mfrom: (13.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090507161634-xqyk0s9na0le4flj
Tags: 1.7dfsg~beta1-4
When  decrypting the TGS response fails with the subkey, try with the
session key to work around Heimdal bug, Closes: #527353 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
 
2
 * Copyright 2007 Massachusetts Institute of Technology.
 
3
 * All Rights Reserved.
 
4
 *
 
5
 * Export of this software from the United States of America may
 
6
 *   require a specific license from the United States Government.
 
7
 *   It is the responsibility of any person or organization contemplating
 
8
 *   export to obtain such a license before exporting.
 
9
 * 
 
10
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 
11
 * distribute this software and its documentation for any purpose and
 
12
 * without fee is hereby granted, provided that the above copyright
 
13
 * notice appear in all copies and that both that copyright notice and
 
14
 * this permission notice appear in supporting documentation, and that
 
15
 * the name of M.I.T. not be used in advertising or publicity pertaining
 
16
 * to distribution of the software without specific, written prior
 
17
 * permission.  Furthermore if you modify this software you must label
 
18
 * your software as modified software and not distribute it in such a
 
19
 * fashion that it might be confused with the original M.I.T. software.
 
20
 * M.I.T. makes no representations about the suitability of
 
21
 * this software for any purpose.  It is provided "as is" without express
 
22
 * or implied warranty.
 
23
 */
 
24
/*
2
25
 * Copyright 1987, 1988 by MIT Student Information Processing Board
3
26
 *
4
27
 * For copyright information, see copyright.h.
7
30
#include "copyright.h"
8
31
#define size    sizeof(ss_data *)
9
32
 
10
 
 
 
33
/* XXX The memory in _ss_table never gets freed up until program exit!
 
34
   If you change the code to free it and stick a null pointer into
 
35
   _ss_table[sci_idx], make sure you change the allocation routine to
 
36
   not assume there are no null pointers in the middle of the
 
37
   array.  */
11
38
int ss_create_invocation(subsystem_name, version_string, info_ptr,
12
39
                         request_table_ptr, code_ptr)
13
40
        char *subsystem_name, *version_string;
17
44
{
18
45
        register int sci_idx;
19
46
        register ss_data *new_table;
20
 
        register ss_data **table;
 
47
        register ss_data **table, **tmp;
21
48
 
22
49
        *code_ptr = 0;
23
50
        table = _ss_table;
24
51
        new_table = (ss_data *) malloc(sizeof(ss_data));
 
52
        if (new_table == NULL) {
 
53
            *code_ptr = errno;
 
54
            return -1;
 
55
        }
25
56
 
26
57
        if (table == (ss_data **) NULL) {
27
58
                table = (ss_data **) malloc(2 * size);
 
59
                if (table == NULL) {
 
60
                    *code_ptr = errno;
 
61
                    return -1;
 
62
                }
28
63
                table[0] = table[1] = (ss_data *)NULL;
 
64
                _ss_table = table;
29
65
        }
30
66
        initialize_ss_error_table ();
31
67
 
32
68
        for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
33
69
                ;
34
 
        table = (ss_data **) realloc((char *)table,
35
 
                                     ((unsigned)sci_idx+2)*size);
 
70
        tmp = (ss_data **) realloc((char *)table,
 
71
                                   ((unsigned)sci_idx+2)*size);
 
72
        if (tmp == NULL) {
 
73
            *code_ptr = errno;
 
74
            return 0;
 
75
        }
 
76
        _ss_table = table = tmp;
36
77
        table[sci_idx+1] = (ss_data *) NULL;
37
 
        table[sci_idx] = new_table;
 
78
        table[sci_idx] = NULL;
38
79
 
39
80
        new_table->subsystem_name = subsystem_name;
40
81
        new_table->subsystem_version = version_string;
41
82
        new_table->argv = (char **)NULL;
42
83
        new_table->current_request = (char *)NULL;
43
84
        new_table->info_dirs = (char **)malloc(sizeof(char *));
 
85
        if (new_table->info_dirs == NULL) {
 
86
            *code_ptr = errno;
 
87
            free(new_table);
 
88
            return 0;
 
89
        }
44
90
        *new_table->info_dirs = (char *)NULL;
45
91
        new_table->info_ptr = info_ptr;
46
 
        new_table->prompt = malloc((unsigned)strlen(subsystem_name)+4);
47
 
        strcpy(new_table->prompt, subsystem_name);
48
 
        strcat(new_table->prompt, ":  ");
49
 
#ifdef silly
50
 
        new_table->abbrev_info = ss_abbrev_initialize("/etc/passwd", code_ptr);
51
 
#else
 
92
        if (asprintf(&new_table->prompt, "%s:  ", subsystem_name) < 0) {
 
93
            *code_ptr = errno;
 
94
            free(new_table->info_dirs);
 
95
            free(new_table);
 
96
            return 0;
 
97
        }
52
98
        new_table->abbrev_info = NULL;
53
 
#endif
54
99
        new_table->flags.escape_disabled = 0;
55
100
        new_table->flags.abbrevs_disabled = 0;
56
101
        new_table->rqt_tables =
57
102
                (ss_request_table **) calloc(2, sizeof(ss_request_table *));
 
103
        if (new_table->rqt_tables == NULL) {
 
104
            *code_ptr = errno;
 
105
            free(new_table->prompt);
 
106
            free(new_table->info_dirs);
 
107
            free(new_table);
 
108
            return 0;
 
109
        }
58
110
        *(new_table->rqt_tables) = request_table_ptr;
59
111
        *(new_table->rqt_tables+1) = (ss_request_table *) NULL;
60
 
        _ss_table = table;
 
112
        table[sci_idx] = new_table;
61
113
        return(sci_idx);
62
114
}
63
115