~ubuntu-branches/ubuntu/breezy/pam/breezy

« back to all changes in this revision

Viewing changes to Linux-PAM/libpam/pam_end.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-06-28 14:28:08 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040628142808-adikk7vtfg3pzcjw
Tags: 0.76-22
* Add uploaders
* Document location of repository
* Fix options containing arguments in pam_unix, Closes: #254904

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* pam_end.c */
 
2
 
 
3
/*
 
4
 * $Id: pam_end.c,v 1.1 2001/04/29 04:17:05 hartmans Exp $
 
5
 */
 
6
 
 
7
#include <stdlib.h>
 
8
 
 
9
#include "pam_private.h"
 
10
 
 
11
int pam_end(pam_handle_t *pamh, int pam_status)
 
12
{
 
13
    int ret;
 
14
 
 
15
    D(("entering pam_end()"));
 
16
 
 
17
    IF_NO_PAMH("pam_end", pamh, PAM_SYSTEM_ERR);
 
18
 
 
19
    if (__PAM_FROM_MODULE(pamh)) {
 
20
        D(("called from module!?"));
 
21
        return PAM_SYSTEM_ERR;
 
22
    }
 
23
 
 
24
    /* first liberate the modules (it is not inconcevible that the
 
25
       modules may need to use the service_name etc. to clean up) */
 
26
 
 
27
    _pam_free_data(pamh, pam_status);
 
28
 
 
29
    /* now drop all modules */
 
30
 
 
31
    if ((ret = _pam_free_handlers(pamh)) != PAM_SUCCESS) {
 
32
        return ret;                 /* error occurred */
 
33
    }
 
34
 
 
35
    /* from this point we cannot call the modules any more. Free the remaining
 
36
       memory used by the Linux-PAM interface */
 
37
 
 
38
    _pam_drop_env(pamh);                      /* purge the environment */
 
39
 
 
40
    _pam_overwrite(pamh->authtok);            /* blank out old token */
 
41
    _pam_drop(pamh->authtok);
 
42
 
 
43
    _pam_overwrite(pamh->oldauthtok);         /* blank out old token */
 
44
    _pam_drop(pamh->oldauthtok);
 
45
 
 
46
    _pam_overwrite(pamh->former.prompt);
 
47
    _pam_drop(pamh->former.prompt);           /* drop saved prompt */
 
48
 
 
49
    _pam_overwrite(pamh->service_name);
 
50
    _pam_drop(pamh->service_name);
 
51
 
 
52
    _pam_overwrite(pamh->user);
 
53
    _pam_drop(pamh->user);
 
54
 
 
55
    _pam_overwrite(pamh->prompt);
 
56
    _pam_drop(pamh->prompt);                  /* prompt for pam_get_user() */
 
57
 
 
58
    _pam_overwrite(pamh->tty);
 
59
    _pam_drop(pamh->tty);
 
60
 
 
61
    _pam_overwrite(pamh->rhost);
 
62
    _pam_drop(pamh->rhost);
 
63
 
 
64
    _pam_overwrite(pamh->ruser);
 
65
    _pam_drop(pamh->ruser);
 
66
 
 
67
    _pam_drop(pamh->pam_conversation);
 
68
    pamh->fail_delay.delay_fn_ptr = NULL;
 
69
 
 
70
    /* and finally liberate the memory for the pam_handle structure */
 
71
 
 
72
    _pam_drop(pamh);
 
73
 
 
74
    D(("exiting pam_end() successfully"));
 
75
 
 
76
    return PAM_SUCCESS;
 
77
}