~ubuntu-branches/ubuntu/raring/sudo/raring

« back to all changes in this revision

Viewing changes to plugins/sudoers/iolog_path.c

  • Committer: Package Import Robot
  • Author(s): Tyler Hicks
  • Date: 2012-07-16 14:01:42 UTC
  • mfrom: (1.3.22 sid)
  • Revision ID: package-import@ubuntu.com-20120716140142-b0tgau0k6nid4mrf
Tags: 1.8.5p2-1ubuntu1
* Merge from debian/testing (LP: #1024154), remaining changes:
  - debian/patches/keep_home_by_default.patch:
    + Set HOME in initial_keepenv_table.
  - debian/rules:
    + compile with --without-lecture --with-tty-tickets (Ubuntu specific)
    + install man/man8/sudo_root.8 in both flavours (Ubuntu specific)
    + install apport hooks
    + The ubuntu-sudo-as-admin-successful.patch was taken upstream by
      Debian however it requires a --enable-admin-flag configure flag to
      actually enable it in both flavours.
  - debian/control:
    + Mark Debian Vcs-* as XS-Debian-Vcs-*
    + update debian/control
  - debian/sudoers:
    + grant admin group sudo access
  - debian/source_sudo.py, debian/sudo-ldap.dirs, debian/sudo.dirs:
    + add usr/share/apport/package-hooks
  - debian/sudo.pam:
    + Use pam_env to read /etc/environment and /etc/default/locale
      environment files. Reading ~/.pam_environment is not permitted due to
      security reasons.
* Dropped changes:
  - debian/patches/lp927828-fix-abort-in-pam-modules-when-timestamp-valid.patch
    + Fixed upstream in 1.8.5
  - debian/patches/CVE-2012-2337.patch:
    + Fixed upstream in 1.8.4p5
  - debian/patches/pam_env_merge.patch:
    + Feature released upstream in 1.8.5
  - debian/{sudo,sudo-ldap}.{preinst,postinst,postrm}:
    + Drop Ubuntu-specific sudoers file migration code because the only
      upgrade path to quantal is from precise. All necessary sudoers file
      migration will have already been done by the time this version of the
      sudo package is installed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
{
74
74
    static char sessid[7];
75
75
    int len;
 
76
    debug_decl(sudoers_io_version, SUDO_DEBUG_UTIL)
76
77
 
77
78
    if (sessid[0] == '\0')
78
79
        io_nextid(def_iolog_dir, sessid);
81
82
    len = snprintf(str, strsize, "%c%c/%c%c/%c%c", sessid[0],
82
83
        sessid[1], sessid[2], sessid[3], sessid[4], sessid[5]);
83
84
    if (len < 0)
84
 
        return strsize; /* handle non-standard snprintf() */
85
 
    return (size_t)len;
 
85
        debug_return_size_t(strsize); /* handle non-standard snprintf() */
 
86
    debug_return_size_t(len);
86
87
}
87
88
 
88
89
static size_t
89
90
fill_user(char *str, size_t strsize)
90
91
{
91
 
    return strlcpy(str, user_name, strsize);
 
92
    debug_decl(fill_user, SUDO_DEBUG_UTIL)
 
93
    debug_return_size_t(strlcpy(str, user_name, strsize));
92
94
}
93
95
 
94
96
static size_t
96
98
{
97
99
    struct group *grp;
98
100
    size_t len;
 
101
    debug_decl(fill_group, SUDO_DEBUG_UTIL)
99
102
 
100
103
    if ((grp = sudo_getgrgid(user_gid)) != NULL) {
101
104
        len = strlcpy(str, grp->gr_name, strsize);
105
108
        len = snprintf(str + len, strsize - len, "#%u",
106
109
            (unsigned int) user_gid);
107
110
    }
108
 
    return len;
 
111
    debug_return_size_t(len);
109
112
}
110
113
 
111
114
static size_t
112
115
fill_runas_user(char *str, size_t strsize)
113
116
{
114
 
    return strlcpy(str, runas_pw->pw_name, strsize);
 
117
    debug_decl(fill_runas_user, SUDO_DEBUG_UTIL)
 
118
    debug_return_size_t(strlcpy(str, runas_pw->pw_name, strsize));
115
119
}
116
120
 
117
121
static size_t
119
123
{
120
124
    struct group *grp;
121
125
    size_t len;
 
126
    debug_decl(fill_runas_group, SUDO_DEBUG_UTIL)
122
127
 
123
128
    if (runas_gr != NULL) {
124
129
        len = strlcpy(str, runas_gr->gr_name, strsize);
132
137
                (unsigned int) runas_pw->pw_gid);
133
138
        }
134
139
    }
135
 
    return len;
 
140
    debug_return_size_t(len);
136
141
}
137
142
 
138
143
static size_t
139
144
fill_hostname(char *str, size_t strsize)
140
145
{
141
 
    return strlcpy(str, user_shost, strsize);
 
146
    debug_decl(fill_hostname, SUDO_DEBUG_UTIL)
 
147
    debug_return_size_t(strlcpy(str, user_shost, strsize));
142
148
}
143
149
 
144
150
static size_t
145
151
fill_command(char *str, size_t strsize)
146
152
{
147
 
    return strlcpy(str, user_base, strsize);
 
153
    debug_decl(fill_command, SUDO_DEBUG_UTIL)
 
154
    debug_return_size_t(strlcpy(str, user_base, strsize));
148
155
}
149
156
 
150
157
/*
159
166
    size_t len, prelen = 0;
160
167
    char *dst, *dst0, *path, *pathend, tmpbuf[PATH_MAX];
161
168
    const char *endbrace, *src = dir;
162
 
    int pass, strfit;
 
169
    int pass;
 
170
    bool strfit;
 
171
    debug_decl(expand_iolog_path, SUDO_DEBUG_UTIL)
163
172
 
164
173
    /* Expanded path must be <= PATH_MAX */
165
174
    if (prefix != NULL)
180
189
        file++;
181
190
 
182
191
    for (pass = 0; pass < 3; pass++) {
183
 
        strfit = FALSE;
 
192
        strfit = false;
184
193
        switch (pass) {
185
194
        case 0:
186
195
            src = dir;
267
276
        }
268
277
    }
269
278
 
270
 
    return path;
 
279
    debug_return_str(path);
271
280
bad:
272
281
    efree(path);
273
 
    return NULL;
 
282
    debug_return_str(NULL);
274
283
}