Deleted Added
full compact
id.c (98243) id.c (202192)
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/ppp/id.c 98243 2002-06-15 08:03:30Z brian $
26 * $FreeBSD: head/usr.sbin/ppp/id.c 202192 2010-01-13 17:54:32Z ed $
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <sys/un.h>
32
33#include <sys/ioctl.h>
34#include <fcntl.h>

--- 9 unchanged lines hidden (view full) ---

44#include <sys/linker.h>
45#endif
46#include <unistd.h>
47#ifdef __OpenBSD__
48#include <util.h>
49#else
50#include <libutil.h>
51#endif
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <sys/un.h>
32
33#include <sys/ioctl.h>
34#include <fcntl.h>

--- 9 unchanged lines hidden (view full) ---

44#include <sys/linker.h>
45#endif
46#include <unistd.h>
47#ifdef __OpenBSD__
48#include <util.h>
49#else
50#include <libutil.h>
51#endif
52#include
52#include <utmpx.h>
53
54#include "log.h"
55#include "main.h"
56#include "id.h"
57
58static int uid;
59static int euid;
60

--- 136 unchanged lines hidden (view full) ---

197 ID0set0();
198 ret = uu_unlock(basettyname);
199 log_Printf(LogID0, "%d = uu_unlock(\"%s\")\n", ret, basettyname);
200 ID0setuser();
201 return ret;
202}
203
204void
53
54#include "log.h"
55#include "main.h"
56#include "id.h"
57
58static int uid;
59static int euid;
60

--- 136 unchanged lines hidden (view full) ---

197 ID0set0();
198 ret = uu_unlock(basettyname);
199 log_Printf(LogID0, "%d = uu_unlock(\"%s\")\n", ret, basettyname);
200 ID0setuser();
201 return ret;
202}
203
204void
205ID0login(struct utmp *ut)
205ID0login(const struct utmpx *ut)
206{
207 ID0set0();
206{
207 ID0set0();
208 if (logout(ut->ut_line)) {
209 log_Printf(LogID0, "logout(\"%s\")\n", ut->ut_line);
210 logwtmp(ut->ut_line, "", "");
211 log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut->ut_line);
212 }
213 login(ut);
214 log_Printf(LogID0, "login(\"%s\", \"%.*s\")\n",
215 ut->ut_line, (int)(sizeof ut->ut_name), ut->ut_name);
208 pututxline(ut);
209 log_Printf(LogID0, "pututxline(\"%.*s\", \"%.*s\", \"%.*s\", \"%.*s\")\n",
210 (int)sizeof ut->ut_id, ut->ut_id,
211 (int)sizeof ut->ut_user, ut->ut_user,
212 (int)sizeof ut->ut_line, ut->ut_line,
213 (int)sizeof ut->ut_host, ut->ut_host);
216 ID0setuser();
217}
218
219void
214 ID0setuser();
215}
216
217void
220ID0logout(const char *device, int nologout)
218ID0logout(const struct utmpx *ut)
221{
219{
222 struct utmp ut;
223 char ut_line[sizeof ut.ut_line + 1];
224
225 strncpy(ut_line, device, sizeof ut_line - 1);
226 ut_line[sizeof ut_line - 1] = '\0';
227
228 ID0set0();
220 ID0set0();
229 if (nologout || logout(ut_line)) {
230 log_Printf(LogID0, "logout(\"%s\")\n", ut_line);
231 logwtmp(ut_line, "", "");
232 log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut_line);
233 } else
234 log_Printf(LogERROR, "ID0logout: No longer logged in on %s\n", ut_line);
221 pututxline(ut);
222 log_Printf(LogID0, "pututxline(\"%.*s\")\n",
223 (int)sizeof ut->ut_id, ut->ut_id);
235 ID0setuser();
236}
237
238int
239ID0bind_un(int s, const struct sockaddr_un *name)
240{
241 int result;
242

--- 61 unchanged lines hidden ---
224 ID0setuser();
225}
226
227int
228ID0bind_un(int s, const struct sockaddr_un *name)
229{
230 int result;
231

--- 61 unchanged lines hidden ---