/[packages]/updates/5/bind/current/SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch
ViewVC logotype

Diff of /updates/5/bind/current/SOURCES/bind-9.3.2b1-fix_sdb_ldap.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1104817 by umeabot, Thu Jun 18 23:58:00 2015 UTC revision 1104818 by guillomovitch, Fri May 26 13:25:52 2017 UTC
# Line 42  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 42  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
42   #include <isc/print.h>   #include <isc/print.h>
43  +#include <isc/hash.h>  +#include <isc/hash.h>
44   #include <isc/result.h>   #include <isc/result.h>
45     #include <isc/string.h>
46    
47   #include <dns/db.h>  @@ -65,6 +66,9 @@ ldap_info;
 @@ -63,6 +64,9 @@ ldap_info;  
48   /* usage Info */   /* usage Info */
49   void usage (void);   void usage (void);
50    
# Line 54  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 54  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
54   /* Add to the ldap dit */   /* Add to the ldap dit */
55   void add_ldap_values (ldap_info * ldinfo);   void add_ldap_values (ldap_info * ldinfo);
56    
57  @@ -79,7 +83,7 @@ char **hostname_to_dn_list (char *hostna  @@ -81,7 +85,7 @@ char **hostname_to_dn_list (char *hostna
58   int get_attr_list_size (char **tmp);   int get_attr_list_size (char **tmp);
59    
60   /* Get a DN */   /* Get a DN */
# Line 63  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 63  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
63    
64   /* Add to RR list */   /* Add to RR list */
65   void add_to_rr_list (char *dn, char *name, char *type, char *data,   void add_to_rr_list (char *dn, char *name, char *type, char *data,
66  @@ -101,11 +105,27 @@ void  @@ -103,11 +107,27 @@ void
67   init_ldap_conn ();   init_ldap_conn ();
68   void usage();   void usage();
69    
# Line 96  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 96  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
96   LDAP *conn;   LDAP *conn;
97   unsigned int debug = 0;   unsigned int debug = 0;
98    
99  @@ -121,12 +141,12 @@ main (int argc, char **argv)  @@ -131,12 +151,12 @@ main (int argc, char **argv)
100     isc_result_t result;     isc_result_t result;
101     char *basedn;     char *basedn;
102     ldap_info *tmp;     ldap_info *tmp;
# Line 112  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 112  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
112     dns_fixedname_t fixedzone, fixedname;     dns_fixedname_t fixedzone, fixedname;
113     dns_rdataset_t rdataset;     dns_rdataset_t rdataset;
114     char **dc_list;     char **dc_list;
115  @@ -139,7 +159,7 @@ main (int argc, char **argv)  @@ -149,7 +169,7 @@ main (int argc, char **argv)
116     extern char *optarg;     extern char *optarg;
117     extern int optind, opterr, optopt;     extern int optind, opterr, optopt;
118     int create_base = 0;     int create_base = 0;
119  -  int topt;  -  int topt;
120  +  int topt, dcn, zdn, znlen;  +  int topt, dcn, zdn, znlen;
121    
122     if ((int) argc < 2)     if (argc < 2)
123       {       {
124  @@ -147,7 +167,7 @@ main (int argc, char **argv)  @@ -157,7 +177,7 @@ main (int argc, char **argv)
125         exit (-1);         exit (-1);
126       }       }
127    
128  -  while ((topt = getopt ((int) argc, argv, "D:w:b:z:f:h:?dcv")) != -1)  -  while ((topt = getopt (argc, argv, "D:w:b:z:f:h:?dcv")) != -1)
129  +  while ((topt = getopt ((int) argc, argv, "D:Ww:b:z:f:h:?dcv")) != -1)  +  while ((topt = getopt (argc, argv, "D:Ww:b:z:f:h:?dcv")) != -1)
130       {       {
131         switch (topt)         switch (topt)
132          {          {
133  @@ -166,8 +186,11 @@ main (int argc, char **argv)  @@ -180,6 +200,9 @@ main (int argc, char **argv)
134          case 'w':            if (bindpw == NULL)
135            bindpw = strdup (optarg);              fatal("strdup");
136            break;            break;
137  +       case 'W':  +       case 'W':
138  +         bindpw = getpass("Enter LDAP Password: ");  +         bindpw = getpass("Enter LDAP Password: ");
139  +         break;  +         break;
140          case 'b':          case 'b':
141  -         ldapbase = strdup (optarg);            ldapbase = strdup (optarg);
142  +          ldapbase = strdup (optarg);            if (ldapbase == NULL)
143            break;  @@ -301,27 +324,62 @@ main (int argc, char **argv)
         case 'z':  
           argzone = strdup (optarg);  
 @@ -279,27 +302,62 @@ main (int argc, char **argv)  
144       {       {
145         if (debug)         if (debug)
146          printf ("Creating base zone DN %s\n", argzone);          printf ("Creating base zone DN %s\n", argzone);
# Line 216  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 213  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
213                  }                  }
214                else                else
215                  {                  {
216  @@ -308,8 +366,13 @@ main (int argc, char **argv)  @@ -330,8 +388,13 @@ main (int argc, char **argv)
217                    else                    else
218                      sprintf (fullbasedn, "%s", ctmp);                      sprintf (fullbasedn, "%s", ctmp);
219                  }                  }
# Line 230  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 227  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
227              }              }
228    
229          }          }
230  @@ -387,14 +450,14 @@ generate_ldap (dns_name_t * dnsname, dns  @@ -409,14 +472,14 @@ generate_ldap (dns_name_t * dnsname, dns
231     isc_result_check (result, "dns_rdata_totext");     isc_result_check (result, "dns_rdata_totext");
232     data[isc_buffer_usedlength (&buff)] = 0;     data[isc_buffer_usedlength (&buff)] = 0;
233    
# Line 248  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 245  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
245   }   }
246    
247    
248  @@ -434,7 +497,8 @@ add_to_rr_list (char *dn, char *name, ch  @@ -456,7 +519,8 @@ add_to_rr_list (char *dn, char *name, ch
249     int attrlist;     int attrlist;
250     char ldap_type_buffer[128];     char ldap_type_buffer[128];
251     char charttl[64];     char charttl[64];
# Line 258  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 255  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
255    
256     if ((tmp = locate_by_dn (dn)) == NULL)     if ((tmp = locate_by_dn (dn)) == NULL)
257       {       {
258  @@ -469,13 +533,13 @@ add_to_rr_list (char *dn, char *name, ch  @@ -483,13 +547,13 @@ add_to_rr_list (char *dn, char *name, ch
259              }              fatal("malloc");
260          }          }
261         tmp->attrs[0]->mod_op = LDAP_MOD_ADD;         tmp->attrs[0]->mod_op = LDAP_MOD_ADD;
262  -      tmp->attrs[0]->mod_type = (char*)"objectClass";  -      tmp->attrs[0]->mod_type = (char*)"objectClass";
# Line 275  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 272  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
272            tmp->attrs[1] = NULL;            tmp->attrs[1] = NULL;
273            tmp->attrcnt = 2;            tmp->attrcnt = 2;
274            tmp->next = ldap_info_base;            tmp->next = ldap_info_base;
275  @@ -484,7 +548,7 @@ add_to_rr_list (char *dn, char *name, ch  @@ -498,7 +562,7 @@ add_to_rr_list (char *dn, char *name, ch
276          }          }
277    
278         tmp->attrs[1]->mod_op = LDAP_MOD_ADD;         tmp->attrs[1]->mod_op = LDAP_MOD_ADD;
# Line 284  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 281  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
281         tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2);         tmp->attrs[1]->mod_values = (char **) calloc (sizeof (char *), 2);
282    
283         if (tmp->attrs[1]->mod_values == (char **)NULL)         if (tmp->attrs[1]->mod_values == (char **)NULL)
284  @@ -506,7 +570,7 @@ add_to_rr_list (char *dn, char *name, ch  @@ -527,7 +591,7 @@ add_to_rr_list (char *dn, char *name, ch
285         tmp->attrs[2]->mod_values[1] = NULL;           fatal("strdup");
286    
287         tmp->attrs[3]->mod_op = LDAP_MOD_ADD;         tmp->attrs[3]->mod_op = LDAP_MOD_ADD;
288  -      tmp->attrs[3]->mod_type = (char*)"dNSTTL";  -      tmp->attrs[3]->mod_type = (char*)"dNSTTL";
# Line 293  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 290  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
290         tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2);         tmp->attrs[3]->mod_values = (char **) calloc (sizeof (char *), 2);
291    
292         if (tmp->attrs[3]->mod_values == (char **)NULL)         if (tmp->attrs[3]->mod_values == (char **)NULL)
293  @@ -516,10 +580,21 @@ add_to_rr_list (char *dn, char *name, ch  @@ -540,14 +604,25 @@ add_to_rr_list (char *dn, char *name, ch
294         tmp->attrs[3]->mod_values[0] = strdup (charttl);         if (tmp->attrs[3]->mod_values[0] == NULL)
295         tmp->attrs[3]->mod_values[1] = NULL;           fatal("strdup");
296    
297  +      znlen=strlen(gbl_zone);        +      znlen=strlen(gbl_zone);      
298  +      if ( *(gbl_zone + (znlen-1)) == '.' )  +      if ( *(gbl_zone + (znlen-1)) == '.' )
# Line 312  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 309  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
309  -      tmp->attrs[4]->mod_type = (char*)"zoneName";  -      tmp->attrs[4]->mod_type = (char*)"zoneName";
310  +      tmp->attrs[4]->mod_type = zoneName;  +      tmp->attrs[4]->mod_type = zoneName;
311         tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2);         tmp->attrs[4]->mod_values = (char **)calloc(sizeof(char *), 2);
312    
313           if (tmp->attrs[4]->mod_values == (char **)NULL)
314             fatal("calloc");
315    
316  -      tmp->attrs[4]->mod_values[0] = gbl_zone;  -      tmp->attrs[4]->mod_values[0] = gbl_zone;
317  +      tmp->attrs[4]->mod_values[0] = zn;  +      tmp->attrs[4]->mod_values[0] = zn;
318         tmp->attrs[4]->mod_values[1] = NULL;         tmp->attrs[4]->mod_values[1] = NULL;
319    
320         tmp->attrs[5] = NULL;         tmp->attrs[5] = NULL;
321  @@ -530,7 +605,7 @@ add_to_rr_list (char *dn, char *name, ch  @@ -558,7 +633,7 @@ add_to_rr_list (char *dn, char *name, ch
322     else     else
323       {       {
324    
# Line 326  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 327  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
327          {          {
328            sprintf (ldap_type_buffer, "%sRecord", type);            sprintf (ldap_type_buffer, "%sRecord", type);
329            if (!strncmp            if (!strncmp
330  @@ -599,69 +674,105 @@ char **  @@ -632,73 +707,105 @@ char **
331   hostname_to_dn_list (char *hostname, char *zone, unsigned int flags)   hostname_to_dn_list (char *hostname, char *zone, unsigned int flags)
332   {   {
333     char *tmp;     char *tmp;
# Line 336  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 337  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
337  -  char *hnamebuff;  -  char *hnamebuff;
338  -  -
339  -  zname = strdup (hostname);  -  zname = strdup (hostname);
340    -  if (zname == NULL)
341    -       fatal("strdup");
342  -  -
343  -  if (flags == DNS_OBJECT)  -  if (flags == DNS_OBJECT)
344  -    {  -    {
# Line 347  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 350  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
350  -         tmp = &zname[strlen (zname) - strlen (zone)];  -         tmp = &zname[strlen (zname) - strlen (zone)];
351  -         *--tmp = '\0';  -         *--tmp = '\0';
352  -         hnamebuff = strdup (zname);  -         hnamebuff = strdup (zname);
353    -         if (hnamebuff == NULL)
354    -               fatal("strdup");
355  -         zname = ++tmp;  -         zname = ++tmp;
356  -       }  -       }
357  -      else  -      else
# Line 433  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 438  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
438    
439  -  -
440   /* build an sdb compatible LDAP DN from a "dc_list" (char **).   /* build an sdb compatible LDAP DN from a "dc_list" (char **).
441    * will append dNSTTL information to each RR Record, with the    * will append dNSTTL information to each RR Record, with the
442    * exception of "@"/SOA. */    * exception of "@"/SOA. */
443    
444   char *   char *
# Line 470  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 475  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
475         else         else
476                sprintf(tmp,"dc=%s,", dc_list[x]);                sprintf(tmp,"dc=%s,", dc_list[x]);
477       }       }
478  @@ -687,6 +798,7 @@ void  @@ -724,6 +835,7 @@ void
479   init_ldap_conn ()   init_ldap_conn ()
480   {   {
481     int result;     int result;
# Line 478  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 483  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
483     conn = ldap_open (ldapsystem, LDAP_PORT);     conn = ldap_open (ldapsystem, LDAP_PORT);
484     if (conn == NULL)     if (conn == NULL)
485       {       {
486  @@ -696,7 +808,7 @@ init_ldap_conn ()  @@ -733,7 +845,7 @@ init_ldap_conn ()
487       }       }
488    
489     result = ldap_simple_bind_s (conn, binddn, bindpw);     result = ldap_simple_bind_s (conn, binddn, bindpw);
# Line 487  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 492  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
492   }   }
493    
494   /* Like isc_result_check, only for LDAP */   /* Like isc_result_check, only for LDAP */
495  @@ -713,8 +825,6 @@ ldap_result_check (const char *msg, char  @@ -750,8 +861,6 @@ ldap_result_check (const char *msg, char
496       }       }
497   }   }
498    
# Line 496  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 501  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
501   /* For running the ldap_info run queue. */   /* For running the ldap_info run queue. */
502   void   void
503   add_ldap_values (ldap_info * ldinfo)   add_ldap_values (ldap_info * ldinfo)
504  @@ -722,14 +832,14 @@ add_ldap_values (ldap_info * ldinfo)  @@ -759,14 +869,14 @@ add_ldap_values (ldap_info * ldinfo)
505     int result;     int result;
506     char dnbuffer[1024];     char dnbuffer[1024];
507    
# Line 513  diff -Naurp bind-9.9.5/bin/sdb_tools/zon Line 518  diff -Naurp bind-9.9.5/bin/sdb_tools/zon
518   }   }
519    
520    
521  @@ -740,7 +850,7 @@ void  @@ -777,5 +887,5 @@ void
522   usage ()   usage ()
523   {   {
524     fprintf (stderr,     fprintf (stderr,
525  -          "zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST]\n"  -          "zone2ldap -D [BIND DN] -w [BIND PASSWORD] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST] "
526  +          "zone2ldap -D [BIND DN] [-w BIND PASSWORD | -W:prompt] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST]\n"  +          "zone2ldap -D [BIND DN] [-w BIND PASSWORD | -W:prompt] -b [BASE DN] -z [ZONE] -f [ZONE FILE] -h [LDAP HOST] "
527             "\t[-c Create LDAP Base structure][-d Debug Output (lots !)]\n "             "[-c Create LDAP Base structure][-d Debug Output (lots !)] \n ");}
            );  
  }  

Legend:
Removed from v.1104817  
changed lines
  Added in v.1104818

  ViewVC Help
Powered by ViewVC 1.1.30