]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd/utmp: remove ip address from utmp record
authorStefan Metzmacher <metze@samba.org>
Tue, 9 Oct 2012 07:38:36 +0000 (09:38 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Oct 2012 12:03:04 +0000 (13:03 +0100)
1. This was broken since Samba 3.2. when ipv6 support was
   added, it only worked for ipv6 addresses.
2. userspace tools only display the hostname field.
3. This is not really portable

metze

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 9b2a3ebf5cfb4613b117ebb83abe92b93e759381)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/configure.in
source3/smbd/proto.h
source3/smbd/session.c
source3/smbd/utmp.c
source3/wscript

index a6cc4440f1e356ee382423f845ca5cddb6a35f8c..6623eadd5531bd24e285a4a656e936169b534a45 100644 (file)
@@ -2229,25 +2229,6 @@ if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
     AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property ut_exit])
 fi
 
-dnl Look for the IPv6 varient by preference. Many systems have both.
-AC_CACHE_CHECK([for ut_addr_v6 in utmp],samba_cv_HAVE_UT_UT_ADDR_V6,[
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <utmp.h>],
-[struct utmp ut;  ut.ut_addr_v6[0] = 0;],
-samba_cv_HAVE_UT_UT_ADDR_V6=yes,samba_cv_HAVE_UT_UT_ADDR_V6=no,samba_cv_HAVE_UT_UT_ADDR_V6=cross)])
-if test x"$samba_cv_HAVE_UT_UT_ADDR_V6" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_ADDR_V6,1,[Whether the utmp struct has a property ut_addr_v6])
-fi
-
-AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <utmp.h>],
-[struct utmp ut;  ut.ut_addr = 0;],
-samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
-if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_ADDR,1,[Whether the utmp struct has a property ut_addr])
-fi
-
 if test x$ac_cv_func_pututline = xyes ; then
   AC_CACHE_CHECK([whether pututline returns pointer],samba_cv_PUTUTLINE_RETURNS_UTMP,[
   AC_TRY_COMPILE([#include <sys/types.h>
index dbd148e29ea83995e6f0534896eded91de540b64..415bf43b8827dfe52cfea117fab63aad055ab917 100644 (file)
@@ -1095,11 +1095,9 @@ uint64_t get_current_vuid(connection_struct *conn);
 /* The following definitions come from smbd/utmp.c  */
 
 void sys_utmp_claim(const char *username, const char *hostname,
-                       const char *ip_addr_str,
-                       const char *id_str, int id_num);
+                   const char *id_str, int id_num);
 void sys_utmp_yield(const char *username, const char *hostname,
-                       const char *ip_addr_str,
-                       const char *id_str, int id_num);
+                   const char *id_str, int id_num);
 
 /* The following definitions come from smbd/vfs.c  */
 
index 47eafab9799a6e09c79923784caa893c65427088..e7e7570f40423a999c0bde57ebd813596b73e582 100644 (file)
@@ -179,7 +179,6 @@ bool session_claim(struct smbd_server_connection *sconn, struct user_struct *vus
 
        if (lp_utmp()) {
                sys_utmp_claim(sessionid.username, sessionid.hostname,
-                              sessionid.ip_addr_str,
                               sessionid.id_str, sessionid.id_num);
        }
 
@@ -219,7 +218,6 @@ void session_yield(struct user_struct *vuser)
 
        if (lp_utmp()) {
                sys_utmp_yield(sessionid.username, sessionid.hostname, 
-                              sessionid.ip_addr_str,
                               sessionid.id_str, sessionid.id_num);
        }
 
index 34b77616b6a61d9e0af6ed06414c5efe86245155..bb48d36946533610abb43ad9cdd0e7bfe2377414 100644 (file)
@@ -115,13 +115,11 @@ Notes:
  */
 
 void sys_utmp_claim(const char *username, const char *hostname,
-                       const char *ip_addr_str,
-                       const char *id_str, int id_num)
+                   const char *id_str, int id_num)
 {}
 
 void sys_utmp_yield(const char *username, const char *hostname,
-                       const char *ip_addr_str,
-                       const char *id_str, int id_num)
+                   const char *id_str, int id_num)
 {}
 
 #else /* WITH_UTMP */
@@ -499,7 +497,6 @@ static int ut_id_encode(int i, char *fourbyte)
 */
 static bool sys_utmp_fill(struct utmp *u,
                        const char *username, const char *hostname,
-                       const char *ip_addr_str,
                        const char *id_str, int id_num)
 {
        struct timeval timeval;
@@ -550,27 +547,6 @@ static bool sys_utmp_fill(struct utmp *u,
 #if defined(HAVE_UT_UT_HOST)
        utmp_strcpy(u->ut_host, hostname, sizeof(u->ut_host));
 #endif
-#if defined(HAVE_IPV6) && defined(HAVE_UT_UT_ADDR_V6)
-       memset(&u->ut_addr_v6, '\0', sizeof(u->ut_addr_v6));
-       if (ip_addr_str) {
-               struct in6_addr addr;
-               if (inet_pton(AF_INET6, ip_addr_str, &addr) > 0) {
-                       memcpy(&u->ut_addr_v6, &addr, sizeof(addr));
-               }
-       }
-#elif defined(HAVE_UT_UT_ADDR)
-       memset(&u->ut_addr, '\0', sizeof(u->ut_addr));
-       if (ip_addr_str) {
-               struct in_addr addr;
-               if (inet_pton(AF_INET, ip_addr_str, &addr) > 0) {
-                       memcpy(&u->ut_addr, &addr, sizeof(addr));
-               }
-       }
-       /*
-        * "(unsigned long) ut_addr" apparently exists on at least HP-UX 10.20.
-        * Volunteer to implement, please ...
-        */
-#endif
 
 #if defined(HAVE_UT_UT_ID)
        if (ut_id_encode(id_num, u->ut_id) != 0) {
@@ -587,8 +563,7 @@ static bool sys_utmp_fill(struct utmp *u,
 ****************************************************************************/
 
 void sys_utmp_yield(const char *username, const char *hostname,
-                       const char *ip_addr_str,
-                       const char *id_str, int id_num)
+                   const char *id_str, int id_num)
 {
        struct utmp u;
 
@@ -603,7 +578,7 @@ void sys_utmp_yield(const char *username, const char *hostname,
        u.ut_type = DEAD_PROCESS;
 #endif
 
-       if (!sys_utmp_fill(&u, username, hostname, ip_addr_str, id_str, id_num))
+       if (!sys_utmp_fill(&u, username, hostname, id_str, id_num))
                return;
 
        sys_utmp_update(&u, NULL, False);
@@ -614,8 +589,7 @@ void sys_utmp_yield(const char *username, const char *hostname,
 ****************************************************************************/
 
 void sys_utmp_claim(const char *username, const char *hostname,
-                       const char *ip_addr_str,
-                       const char *id_str, int id_num)
+                   const char *id_str, int id_num)
 {
        struct utmp u;
 
@@ -625,7 +599,7 @@ void sys_utmp_claim(const char *username, const char *hostname,
        u.ut_type = USER_PROCESS;
 #endif
 
-       if (!sys_utmp_fill(&u, username, hostname, ip_addr_str, id_str, id_num))
+       if (!sys_utmp_fill(&u, username, hostname, id_str, id_num))
                return;
 
        sys_utmp_update(&u, hostname, True);
index c419efc1df93f2bc8128966900ed67b62d843a4b..75578eb2e784971484ef54d67861ad7ba6891018 100644 (file)
@@ -651,10 +651,6 @@ msg.msg_acctrightslen = sizeof(fd);
                                     define='HAVE_UT_UT_PID')
         conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_exit.e_exit', headers='utmp.h',
                                     define='HAVE_UT_UT_EXIT')
-        conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr_v6', headers='utmp.h',
-                                    define='HAVE_UT_UT_ADDR_V6')
-        conf.CHECK_STRUCTURE_MEMBER('struct utmp', 'ut_addr', headers='utmp.h',
-                                    define='HAVE_UT_UT_ADDR')
         conf.CHECK_STRUCTURE_MEMBER('struct utmpx', 'ut_syslen', headers='utmpx.h',
                                     define='HAVE_UX_UT_SYSLEN')
         conf.CHECK_CODE('struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);',