2
* Copyright (c) 2008 , Nicolas François
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. The name of the copyright holders or contributors may not be used to
14
* endorse or promote products derived from this software without
15
* specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
#include "prototypes.h"
41
* cleanup_report_add_group - Report failure to add a group to the system
43
* It should be registered when it is decided to add a group to the system.
45
void cleanup_report_add_group (void *group_name)
47
const char *name = (const char *)group_name;
49
SYSLOG ((LOG_ERR, "failed to add group %s", name));
51
audit_logger (AUDIT_ADD_GROUP, Prog,
54
SHADOW_AUDIT_FAILURE);
59
* cleanup_report_del_group - Report failure to remove a group from the system
61
* It should be registered when it is decided to remove a group from the system.
63
void cleanup_report_del_group (void *group_name)
65
const char *name = (const char *)group_name;
67
SYSLOG ((LOG_ERR, "failed to remove group %s", name));
69
audit_logger (AUDIT_DEL_GROUP, Prog,
72
SHADOW_AUDIT_FAILURE);
76
void cleanup_report_mod_group (void *cleanup_info)
78
const struct cleanup_info_mod *info;
79
info = (const struct cleanup_info_mod *)cleanup_info;
82
"failed to change %s (%s)",
86
audit_logger (AUDIT_USER_ACCT, Prog,
88
info->name, AUDIT_NO_ID,
89
SHADOW_AUDIT_FAILURE);
94
void cleanup_report_mod_gshadow (void *cleanup_info)
96
const struct cleanup_info_mod *info;
97
info = (const struct cleanup_info_mod *)cleanup_info;
100
"failed to change %s (%s)",
104
audit_logger (AUDIT_USER_ACCT, Prog,
106
info->name, AUDIT_NO_ID,
107
SHADOW_AUDIT_FAILURE);
113
* cleanup_report_add_group_group - Report failure to add a group to group
115
* It should be registered when it is decided to add a group to the
118
void cleanup_report_add_group_group (void *group_name)
120
const char *name = (const char *)group_name;
122
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ()));
124
audit_logger (AUDIT_ADD_GROUP, Prog,
125
"adding group to /etc/group",
127
SHADOW_AUDIT_FAILURE);
133
* cleanup_report_add_group_gshadow - Report failure to add a group to gshadow
135
* It should be registered when it is decided to add a group to the
138
void cleanup_report_add_group_gshadow (void *group_name)
140
const char *name = (const char *)group_name;
142
SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ()));
144
audit_logger (AUDIT_ADD_GROUP, Prog,
145
"adding group to /etc/gshadow",
147
SHADOW_AUDIT_FAILURE);
153
* cleanup_report_del_group_group - Report failure to remove a group from the
154
* regular group database
156
* It should be registered when it is decided to remove a group from the
157
* regular group database.
159
void cleanup_report_del_group_group (void *group_name)
161
const char *name = (const char *)group_name;
164
"failed to remove group %s from %s",
165
name, gr_dbname ()));
167
audit_logger (AUDIT_ADD_GROUP, Prog,
168
"removing group from /etc/group",
170
SHADOW_AUDIT_FAILURE);
176
* cleanup_report_del_group_gshadow - Report failure to remove a group from
179
* It should be registered when it is decided to remove a group from the
182
void cleanup_report_del_group_gshadow (void *group_name)
184
const char *name = (const char *)group_name;
187
"failed to remove group %s from %s",
188
name, sgr_dbname ()));
190
audit_logger (AUDIT_ADD_GROUP, Prog,
191
"removing group from /etc/gshadow",
193
SHADOW_AUDIT_FAILURE);
199
* cleanup_unlock_group - Unlock the group file
201
* It should be registered after the group file is successfully locked.
203
void cleanup_unlock_group (unused void *arg)
205
if (gr_unlock () == 0) {
207
_("%s: failed to unlock %s\n"),
209
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
211
audit_logger_message ("unlocking group file",
212
SHADOW_AUDIT_FAILURE);
219
* cleanup_unlock_gshadow - Unlock the gshadow file
221
* It should be registered after the gshadow file is successfully locked.
223
void cleanup_unlock_gshadow (unused void *arg)
225
if (sgr_unlock () == 0) {
227
_("%s: failed to unlock %s\n"),
228
Prog, sgr_dbname ());
229
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
231
audit_logger_message ("unlocking gshadow file",
232
SHADOW_AUDIT_FAILURE);