Makefile: Fix for OSF1 typo.
authorJeremy Allison <jra@samba.org>
Thu, 29 Jan 1998 08:25:46 +0000 (08:25 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 29 Jan 1998 08:25:46 +0000 (08:25 +0000)
asyncdns.c: Fixes that went into 1.9.18p2 - allow unclocking of sigterm.
chgpasswd.c: char -> unsigned char fixes.
includes.h: AIX fix to get prototype for inet_ntoa.
local.h: Tune size of shared memory based on MAX_OPEN_FILES.
nmbd_mynames.c: Fix for nmbd repeated refresh bug.
nmbd_responserecordsdb.c: Fix for nmbd repeated refresh bug.
nmbd_winsserver.c: Fix for multi-homed registration optimisation.
smb.h: Moved default shared memory size to local.h
Jeremy.
(This used to be commit fa5466805685d461564054d7d9947948fc56ae93)

source3/include/includes.h
source3/include/local.h
source3/include/proto.h
source3/include/smb.h
source3/nmbd/asyncdns.c
source3/nmbd/nmbd_mynames.c
source3/nmbd/nmbd_responserecordsdb.c
source3/nmbd/nmbd_winsserver.c
source3/smbd/chgpasswd.c

index f021fa952e7b139ec1bc4be4ceefd1bc3d8cf375..218ce19955950d673e1e37068f025aaaec437d68 100644 (file)
@@ -554,6 +554,7 @@ char *mktemp(char *); /* No standard include */
 #include <sys/priv.h>
 #include <netinet/tcp.h>
 #include <locale.h>
+#include <arpa/inet.h>    /* needed for inet_ntoa proto */
 #define SYSV
 #define USE_WAITPID
 #define USE_SIGBLOCK
index 10906d1ff1eeeae9eb841b8990c07c906a18e5fd..0e2a927d2eee41154d45180caa90b3b70a6d2146 100644 (file)
 #define MAX_CONNECTIONS 127
 #define MAX_OPEN_FILES 100
 
+/* Default size of shared memory used for share mode locking */
+#ifndef SHMEM_SIZE
+#define SHMEM_SIZE (1024*MAX_OPEN_FILES)
+#endif
+
 /* the max number of connections that the smbstatus program will show */
 #define MAXSTATUS 1000
 
index f422b8fc901a8d6b90fdd2417251129b87758172..fd31db7e629a7985e697bbaab7d305bd834fc438 100644 (file)
@@ -47,7 +47,7 @@ BOOL chgpasswd(char *name,char *oldpass,char *newpass);
 BOOL chgpasswd(char *name,char *oldpass,char *newpass);
 BOOL check_lanman_password(char *user, unsigned char *pass1, 
                            unsigned char *pass2, struct smb_passwd **psmbpw);
-BOOL change_lanman_password(struct smb_passwd *smbpw, char *pass1, char *pass2);
+BOOL change_lanman_password(struct smb_passwd *smbpw, unsigned char *pass1, unsigned char *pass2);
 
 /*The following definitions come from  client.c  */
 
@@ -710,6 +710,7 @@ struct response_record *make_response_record( struct subnet_record *subrec,
                     struct userdata_struct *userdata);
 struct response_record *find_response_record(struct subnet_record **ppsubrec,
                                uint16 id);
+BOOL is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
 
 /*The following definitions come from  nmbd_sendannounce.c  */
 
index 9c55e3f8be41aab53ffdcfe13e5423a583f5eb68..9a7278069d4ab22384497c2fd340f6826349eb05 100644 (file)
 #define BUFFER_SIZE (0xFFFF)
 #define SAFETY_MARGIN 1024
 
-/* Default size of shared memory used for share mode locking */
-#ifndef SHMEM_SIZE
-#define SHMEM_SIZE 102400
-#endif
-
 #define NMB_PORT 137
 #define DGRAM_PORT 138
 #define SMB_PORT 139
index ee3fdfcd17ca5b6de6848188ad13ea61b5b968ae..3b71369d67058d57e41ffc6c6514017b20e94012 100644 (file)
@@ -187,6 +187,9 @@ void run_dns_queue(void)
        if (fd_in == -1)
                return;
 
+        /* Allow SIGTERM to kill us. */
+        BlockSignals(False, SIGTERM);
+
        if (!process_exists(child_pid)) {
                close(fd_in);
                start_async_dns();
@@ -197,9 +200,12 @@ void run_dns_queue(void)
                        DEBUG(0,("Incomplete DNS answer from child!\n"));
                        fd_in = -1;
                }
+                BlockSignals(True, SIGTERM);
                return;
        }
 
+        BlockSignals(True, SIGTERM);
+
        namerec = add_dns_result(&r.name, r.result);
 
        if (dns_current) {
@@ -305,8 +311,14 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
 
        DEBUG(3,("DNS search for %s - ", namestr(question)));
 
+        /* Unblock TERM signal so we can be killed in DNS lookup. */
+        BlockSignals(False, SIGTERM);
+
        dns_ip.s_addr = interpret_addr(qname);
 
+        /* Re-block TERM signal. */
+        BlockSignals(True, SIGTERM);
+
        *n = add_dns_result(question, dns_ip);
         if(*n == NULL)
           send_wins_name_query_response(NAM_ERR, p, NULL);
index 035d1e6d3f037ed1bfe005c898f468aeadd213e0..9441449bedaf6d0bfecd16309e1822b17792ee6b 100644 (file)
@@ -156,7 +156,8 @@ void refresh_my_names(time_t t)
            multiple refresh calls being done. We actually
            deal with refresh failure in the fail_fn.
          */
-        refresh_name(subrec, namerec, NULL, NULL, NULL);
+        if(!is_refresh_already_queued( subrec, namerec))
+          refresh_name(subrec, namerec, NULL, NULL, NULL);
        namerec->death_time += lp_max_ttl();
        namerec->refresh_time += lp_max_ttl();
       }
index a075284a4af3a4b2e20103ebb944c764dc0046a3..ceace36a6199d226b1f6a5c09f369243d98b6df5 100644 (file)
@@ -236,3 +236,28 @@ matching record.\n", id));
 
   return NULL;
 }
+
+/****************************************************************************
+  Check if a refresh is queued for a particular name on a particular subnet.
+  **************************************************************************/
+   
+BOOL is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec)
+{  
+  struct response_record *rrec = NULL;
+   
+  for (rrec = subrec->responselist; rrec; rrec = rrec->next)
+  {
+    struct packet_struct *p = rrec->packet;
+    struct nmb_packet *nmb = &p->packet.nmb;
+
+    if((nmb->header.opcode == NMB_NAME_REFRESH_OPCODE_8) ||
+       (nmb->header.opcode == NMB_NAME_REFRESH_OPCODE_9))
+    {
+      /* Yes it's a queued refresh - check if the name is correct. */
+      if(nmb_name_equal(&nmb->question.question_name, &namerec->name))
+        return True;
+    }
+  }
+
+  return False;
+} 
index eb120e0918852722714a68272cc3167f211b27a9..134b758c2938eff309d371dcdae30e274a626b6b 100644 (file)
@@ -1051,6 +1051,18 @@ is one of our (WINS server) names. Denying registration.\n", namestr(question) )
     }
   }
 
+  /*
+   * If the name exists check if the IP address is already registered
+   * to that name. If so then update the ttl and reply success.
+   */
+
+  if((namerec != NULL) && find_ip_in_name_record(namerec, from_ip))
+  {
+    update_name_ttl(namerec, ttl);
+    send_wins_name_registration_response(0, ttl, p);
+    return;
+  }
+
   /*
    * If the name exists do a query to the owner
    * to see if they still want the name.
@@ -1548,7 +1560,7 @@ void wins_write_database(void)
 
     if (namerec->source == REGISTER_NAME)
     {
-      fprintf(fp, "%s#%02x %d ",
+      fprintf(fp, "\"%s#%02x\" %d ",
              namerec->name.name,namerec->name.name_type, /* Ignore scope. */
              (int)namerec->death_time);
 
index b516ec8ac8ee645305f821547cf70993ce0601a8..80c7a43750ff0b3a0a41c3205da153bb4cd4b447 100644 (file)
@@ -451,9 +451,9 @@ BOOL check_lanman_password(char *user, unsigned char *pass1,
  no longer be valid.
 ************************************************************/
 
-BOOL change_lanman_password(struct smb_passwd *smbpw, char *pass1, char *pass2)
+BOOL change_lanman_password(struct smb_passwd *smbpw, unsigned char *pass1, unsigned char *pass2)
 {
-  char unenc_new_pw[16];
+  unsigned char unenc_new_pw[16];
   BOOL ret;
 
   if(smbpw == NULL)