• Home
  • Raw
  • Download

Lines Matching refs:li

194 void set_utmp_time(struct logininfo *li, struct utmp *ut);
195 void construct_utmp(struct logininfo *li, struct utmp *ut);
199 void set_utmpx_time(struct logininfo *li, struct utmpx *ut);
200 void construct_utmpx(struct logininfo *li, struct utmpx *ut);
203 int utmp_write_entry(struct logininfo *li);
204 int utmpx_write_entry(struct logininfo *li);
205 int wtmp_write_entry(struct logininfo *li);
206 int wtmpx_write_entry(struct logininfo *li);
207 int lastlog_write_entry(struct logininfo *li);
208 int syslogin_write_entry(struct logininfo *li);
210 int getlast_entry(struct logininfo *li);
211 int lastlog_get_entry(struct logininfo *li);
212 int utmpx_get_entry(struct logininfo *li);
213 int wtmp_get_entry(struct logininfo *li);
214 int wtmpx_get_entry(struct logininfo *li);
236 login_login(struct logininfo *li) in login_login() argument
238 li->type = LTYPE_LOGIN; in login_login()
239 return (login_write(li)); in login_login()
253 login_logout(struct logininfo *li) in login_logout() argument
255 li->type = LTYPE_LOGOUT; in login_logout()
256 return (login_write(li)); in login_logout()
280 struct logininfo li; in login_get_lastlog_time() local
282 if (login_get_lastlog(&li, uid)) in login_get_lastlog_time()
283 return (li.tv_sec); in login_get_lastlog_time()
302 login_get_lastlog(struct logininfo *li, const uid_t uid) in login_get_lastlog() argument
306 memset(li, '\0', sizeof(*li)); in login_get_lastlog()
307 li->uid = uid; in login_get_lastlog()
319 if (strlcpy(li->username, pw->pw_name, sizeof(li->username)) >= in login_get_lastlog()
320 sizeof(li->username)) { in login_get_lastlog()
323 (unsigned long)sizeof(li->username) - 1); in login_get_lastlog()
327 if (getlast_entry(li)) in login_get_lastlog()
328 return (li); in login_get_lastlog()
357 login_free_entry(struct logininfo *li) in login_free_entry() argument
359 free(li); in login_free_entry()
372 login_init_entry(struct logininfo *li, pid_t pid, const char *username, in login_init_entry() argument
377 memset(li, 0, sizeof(*li)); in login_init_entry()
379 li->pid = pid; in login_init_entry()
383 line_fullname(li->line, line, sizeof(li->line)); in login_init_entry()
386 strlcpy(li->username, username, sizeof(li->username)); in login_init_entry()
387 pw = getpwnam(li->username); in login_init_entry()
390 li->username); in login_init_entry()
392 li->uid = pw->pw_uid; in login_init_entry()
396 strlcpy(li->hostname, hostname, sizeof(li->hostname)); in login_init_entry()
409 login_set_current_time(struct logininfo *li) in login_set_current_time() argument
415 li->tv_sec = tv.tv_sec; in login_set_current_time()
416 li->tv_usec = tv.tv_usec; in login_set_current_time()
421 login_set_addr(struct logininfo *li, const struct sockaddr *sa, in login_set_addr() argument
427 if (sizeof(li->hostaddr) < sa_size) in login_set_addr()
428 bufsize = sizeof(li->hostaddr); in login_set_addr()
430 memcpy(&li->hostaddr.sa, sa, bufsize); in login_set_addr()
439 login_write(struct logininfo *li) in login_write() argument
449 login_set_current_time(li); in login_write()
451 syslogin_write_entry(li); in login_write()
454 if (li->type == LTYPE_LOGIN) in login_write()
455 lastlog_write_entry(li); in login_write()
458 utmp_write_entry(li); in login_write()
461 wtmp_write_entry(li); in login_write()
464 utmpx_write_entry(li); in login_write()
467 wtmpx_write_entry(li); in login_write()
470 if (li->type == LTYPE_LOGIN && in login_write()
471 !sys_auth_record_login(li->username,li->hostname,li->line, in login_write()
473 logit("Writing login record failed for %s", li->username); in login_write()
476 if (li->type == LTYPE_LOGIN) in login_write()
477 audit_session_open(li); in login_write()
478 else if (li->type == LTYPE_LOGOUT) in login_write()
479 audit_session_close(li); in login_write()
486 login_utmp_only(struct logininfo *li) in login_utmp_only() argument
488 li->type = LTYPE_LOGIN; in login_utmp_only()
489 login_set_current_time(li); in login_utmp_only()
491 utmp_write_entry(li); in login_utmp_only()
494 wtmp_write_entry(li); in login_utmp_only()
497 utmpx_write_entry(li); in login_utmp_only()
500 wtmpx_write_entry(li); in login_utmp_only()
513 getlast_entry(struct logininfo *li) in getlast_entry() argument
516 return(lastlog_get_entry(li)); in getlast_entry()
520 return (utmpx_get_entry(li)); in getlast_entry()
530 return (wtmp_get_entry(li)); in getlast_entry()
534 return (wtmpx_get_entry(li)); in getlast_entry()
638 set_utmp_time(struct logininfo *li, struct utmp *ut) in set_utmp_time() argument
641 ut->ut_tv.tv_sec = li->tv_sec; in set_utmp_time()
642 ut->ut_tv.tv_usec = li->tv_usec; in set_utmp_time()
644 ut->ut_time = li->tv_sec; in set_utmp_time()
649 construct_utmp(struct logininfo *li, in construct_utmp() argument
661 line_abbrevname(ut->ut_id, li->line, sizeof(ut->ut_id)); in construct_utmp()
666 switch (li->type) { in construct_utmp()
675 set_utmp_time(li, ut); in construct_utmp()
677 line_stripname(ut->ut_line, li->line, sizeof(ut->ut_line)); in construct_utmp()
680 ut->ut_pid = li->pid; in construct_utmp()
684 if (li->type == LTYPE_LOGOUT) in construct_utmp()
693 strncpy(ut->ut_name, li->username, in construct_utmp()
694 MIN_SIZEOF(ut->ut_name, li->username)); in construct_utmp()
696 strncpy(ut->ut_host, li->hostname, in construct_utmp()
697 MIN_SIZEOF(ut->ut_host, li->hostname)); in construct_utmp()
701 if (li->hostaddr.sa.sa_family == AF_INET) in construct_utmp()
702 ut->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr; in construct_utmp()
706 if (li->hostaddr.sa.sa_family == AF_INET6) { in construct_utmp()
707 sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa); in construct_utmp()
730 set_utmpx_time(struct logininfo *li, struct utmpx *utx) in set_utmpx_time() argument
733 utx->ut_tv.tv_sec = li->tv_sec; in set_utmpx_time()
734 utx->ut_tv.tv_usec = li->tv_usec; in set_utmpx_time()
736 utx->ut_time = li->tv_sec; in set_utmpx_time()
741 construct_utmpx(struct logininfo *li, struct utmpx *utx) in construct_utmpx() argument
749 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id)); in construct_utmpx()
753 switch (li->type) { in construct_utmpx()
761 line_stripname(utx->ut_line, li->line, sizeof(utx->ut_line)); in construct_utmpx()
762 set_utmpx_time(li, utx); in construct_utmpx()
763 utx->ut_pid = li->pid; in construct_utmpx()
766 strncpy(utx->ut_user, li->username, in construct_utmpx()
767 MIN_SIZEOF(utx->ut_user, li->username)); in construct_utmpx()
769 if (li->type == LTYPE_LOGOUT) in construct_utmpx()
778 strncpy(utx->ut_host, li->hostname, in construct_utmpx()
779 MIN_SIZEOF(utx->ut_host, li->hostname)); in construct_utmpx()
783 if (li->hostaddr.sa.sa_family == AF_INET) in construct_utmpx()
784 utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr; in construct_utmpx()
788 if (li->hostaddr.sa.sa_family == AF_INET6) { in construct_utmpx()
789 sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa); in construct_utmpx()
801 utx->ut_syslen = MIN(strlen(li->hostname), sizeof(utx->ut_host)); in construct_utmpx()
823 utmp_write_library(struct logininfo *li, struct utmp *ut) in utmp_write_library() argument
839 utmp_write_direct(struct logininfo *li, struct utmp *ut) in utmp_write_direct() argument
922 utmp_perform_login(struct logininfo *li) in utmp_perform_login() argument
926 construct_utmp(li, &ut); in utmp_perform_login()
928 if (!utmp_write_library(li, &ut)) { in utmp_perform_login()
933 if (!utmp_write_direct(li, &ut)) { in utmp_perform_login()
943 utmp_perform_logout(struct logininfo *li) in utmp_perform_logout() argument
947 construct_utmp(li, &ut); in utmp_perform_logout()
949 if (!utmp_write_library(li, &ut)) { in utmp_perform_logout()
954 if (!utmp_write_direct(li, &ut)) { in utmp_perform_logout()
964 utmp_write_entry(struct logininfo *li) in utmp_write_entry() argument
966 switch(li->type) { in utmp_write_entry()
968 return (utmp_perform_login(li)); in utmp_write_entry()
971 return (utmp_perform_logout(li)); in utmp_write_entry()
998 utmpx_write_library(struct logininfo *li, struct utmpx *utx) in utmpx_write_library() argument
1013 utmpx_write_direct(struct logininfo *li, struct utmpx *utx) in utmpx_write_direct() argument
1021 utmpx_perform_login(struct logininfo *li) in utmpx_perform_login() argument
1025 construct_utmpx(li, &utx); in utmpx_perform_login()
1027 if (!utmpx_write_library(li, &utx)) { in utmpx_perform_login()
1032 if (!utmpx_write_direct(li, &ut)) { in utmpx_perform_login()
1042 utmpx_perform_logout(struct logininfo *li) in utmpx_perform_logout() argument
1046 construct_utmpx(li, &utx); in utmpx_perform_logout()
1048 line_abbrevname(utx.ut_id, li->line, sizeof(utx.ut_id)); in utmpx_perform_logout()
1055 utmpx_write_library(li, &utx); in utmpx_perform_logout()
1057 utmpx_write_direct(li, &utx); in utmpx_perform_logout()
1063 utmpx_write_entry(struct logininfo *li) in utmpx_write_entry() argument
1065 switch(li->type) { in utmpx_write_entry()
1067 return (utmpx_perform_login(li)); in utmpx_write_entry()
1069 return (utmpx_perform_logout(li)); in utmpx_write_entry()
1089 wtmp_write(struct logininfo *li, struct utmp *ut) in wtmp_write() argument
1111 wtmp_perform_login(struct logininfo *li) in wtmp_perform_login() argument
1115 construct_utmp(li, &ut); in wtmp_perform_login()
1116 return (wtmp_write(li, &ut)); in wtmp_perform_login()
1121 wtmp_perform_logout(struct logininfo *li) in wtmp_perform_logout() argument
1125 construct_utmp(li, &ut); in wtmp_perform_logout()
1126 return (wtmp_write(li, &ut)); in wtmp_perform_logout()
1131 wtmp_write_entry(struct logininfo *li) in wtmp_write_entry() argument
1133 switch(li->type) { in wtmp_write_entry()
1135 return (wtmp_perform_login(li)); in wtmp_write_entry()
1137 return (wtmp_perform_logout(li)); in wtmp_write_entry()
1164 wtmp_islogin(struct logininfo *li, struct utmp *ut) in wtmp_islogin() argument
1166 if (strncmp(li->username, ut->ut_name, in wtmp_islogin()
1167 MIN_SIZEOF(li->username, ut->ut_name)) == 0) { in wtmp_islogin()
1179 wtmp_get_entry(struct logininfo *li) in wtmp_get_entry() argument
1186 li->tv_sec = li->tv_usec = 0; in wtmp_get_entry()
1214 if (wtmp_islogin(li, &ut) ) { in wtmp_get_entry()
1221 li->tv_sec = ut.ut_time; in wtmp_get_entry()
1224 li->tv_sec = ut.ut_tv.tv_sec; in wtmp_get_entry()
1227 line_fullname(li->line, ut.ut_line, in wtmp_get_entry()
1228 MIN_SIZEOF(li->line, ut.ut_line)); in wtmp_get_entry()
1230 strlcpy(li->hostname, ut.ut_host, in wtmp_get_entry()
1231 MIN_SIZEOF(li->hostname, ut.ut_host)); in wtmp_get_entry()
1260 wtmpx_write(struct logininfo *li, struct utmpx *utx) in wtmpx_write() argument
1290 wtmpx_perform_login(struct logininfo *li) in wtmpx_perform_login() argument
1294 construct_utmpx(li, &utx); in wtmpx_perform_login()
1295 return (wtmpx_write(li, &utx)); in wtmpx_perform_login()
1300 wtmpx_perform_logout(struct logininfo *li) in wtmpx_perform_logout() argument
1304 construct_utmpx(li, &utx); in wtmpx_perform_logout()
1305 return (wtmpx_write(li, &utx)); in wtmpx_perform_logout()
1310 wtmpx_write_entry(struct logininfo *li) in wtmpx_write_entry() argument
1312 switch(li->type) { in wtmpx_write_entry()
1314 return (wtmpx_perform_login(li)); in wtmpx_write_entry()
1316 return (wtmpx_perform_logout(li)); in wtmpx_write_entry()
1328 wtmpx_islogin(struct logininfo *li, struct utmpx *utx) in wtmpx_islogin() argument
1330 if (strncmp(li->username, utx->ut_user, in wtmpx_islogin()
1331 MIN_SIZEOF(li->username, utx->ut_user)) == 0 ) { in wtmpx_islogin()
1344 wtmpx_get_entry(struct logininfo *li) in wtmpx_get_entry() argument
1351 li->tv_sec = li->tv_usec = 0; in wtmpx_get_entry()
1383 if (wtmpx_islogin(li, &utx)) { in wtmpx_get_entry()
1386 li->tv_sec = utx.ut_tv.tv_sec; in wtmpx_get_entry()
1388 li->tv_sec = utx.ut_time; in wtmpx_get_entry()
1390 line_fullname(li->line, utx.ut_line, sizeof(li->line)); in wtmpx_get_entry()
1392 strlcpy(li->hostname, utx.ut_host, in wtmpx_get_entry()
1393 MIN_SIZEOF(li->hostname, utx.ut_host)); in wtmpx_get_entry()
1414 syslogin_perform_login(struct logininfo *li) in syslogin_perform_login() argument
1419 construct_utmp(li, ut); in syslogin_perform_login()
1427 syslogin_perform_logout(struct logininfo *li) in syslogin_perform_logout() argument
1432 (void)line_stripname(line, li->line, sizeof(line)); in syslogin_perform_logout()
1449 syslogin_write_entry(struct logininfo *li) in syslogin_write_entry() argument
1451 switch (li->type) { in syslogin_write_entry()
1453 return (syslogin_perform_login(li)); in syslogin_write_entry()
1455 return (syslogin_perform_logout(li)); in syslogin_write_entry()
1474 lastlog_openseek(struct logininfo *li, int *fd, int filemode) in lastlog_openseek() argument
1487 LASTLOG_FILE, li->username); in lastlog_openseek()
1505 offset = (off_t) ((u_long)li->uid * sizeof(struct lastlog)); in lastlog_openseek()
1521 lastlog_write_entry(struct logininfo *li) in lastlog_write_entry() argument
1523 switch(li->type) { in lastlog_write_entry()
1533 lastlog_write_entry(struct logininfo *li) in lastlog_write_entry() argument
1538 switch(li->type) { in lastlog_write_entry()
1542 line_stripname(last.ll_line, li->line, sizeof(last.ll_line)); in lastlog_write_entry()
1543 strlcpy(last.ll_host, li->hostname, in lastlog_write_entry()
1544 MIN_SIZEOF(last.ll_host, li->hostname)); in lastlog_write_entry()
1545 last.ll_time = li->tv_sec; in lastlog_write_entry()
1547 if (!lastlog_openseek(li, &fd, O_RDWR|O_CREAT)) in lastlog_write_entry()
1569 lastlog_get_entry(struct logininfo *li) in lastlog_get_entry() argument
1573 if ((ll = getlastlogxbyname(li->username, &l)) == NULL) { in lastlog_get_entry()
1577 line_fullname(li->line, ll->ll_line, sizeof(li->line)); in lastlog_get_entry()
1578 strlcpy(li->hostname, ll->ll_host, in lastlog_get_entry()
1579 MIN_SIZEOF(li->hostname, ll->ll_host)); in lastlog_get_entry()
1580 li->tv_sec = ll->ll_tv.tv_sec; in lastlog_get_entry()
1581 li->tv_usec = ll->ll_tv.tv_usec; in lastlog_get_entry()
1586 lastlog_get_entry(struct logininfo *li) in lastlog_get_entry() argument
1591 if (!lastlog_openseek(li, &fd, O_RDONLY)) in lastlog_get_entry()
1602 line_fullname(li->line, last.ll_line, sizeof(li->line)); in lastlog_get_entry()
1603 strlcpy(li->hostname, last.ll_host, in lastlog_get_entry()
1604 MIN_SIZEOF(li->hostname, last.ll_host)); in lastlog_get_entry()
1605 li->tv_sec = last.ll_time; in lastlog_get_entry()
1626 utmpx_get_entry(struct logininfo *li) in utmpx_get_entry() argument
1632 utx = getutxuser(li->username); in utmpx_get_entry()
1638 line_fullname(li->line, utx->ut_line, in utmpx_get_entry()
1639 MIN_SIZEOF(li->line, utx->ut_line)); in utmpx_get_entry()
1640 strlcpy(li->hostname, utx->ut_host, in utmpx_get_entry()
1641 MIN_SIZEOF(li->hostname, utx->ut_host)); in utmpx_get_entry()
1642 li->tv_sec = utx->ut_tv.tv_sec; in utmpx_get_entry()
1643 li->tv_usec = utx->ut_tv.tv_usec; in utmpx_get_entry()