comparison src/pst2ldif.cpp @ 108:1b2a4fac1303 stable-0-6-21

fix title bug with old schema in pst2ldif, also escape commas in distinguished names per rfc4514.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 21 Oct 2008 14:37:13 -0700
parents 07d090676ce9
children e213bfcf9aa7
comparison
equal deleted inserted replaced
107:9f303a9ad042 108:1b2a4fac1303
159 if (old_schema) { 159 if (old_schema) {
160 if (item->contact->job_title) 160 if (item->contact->job_title)
161 print_ldif_single("personalTitle", item->contact->job_title); 161 print_ldif_single("personalTitle", item->contact->job_title);
162 if (item->contact->company_name) 162 if (item->contact->company_name)
163 print_ldif_single("company", item->contact->company_name); 163 print_ldif_single("company", item->contact->company_name);
164 }
164 else { 165 else {
165 // new schema 166 // new schema
166 if (item->contact->job_title) 167 if (item->contact->job_title)
167 print_ldif_single("title", item->contact->job_title); 168 print_ldif_single("title", item->contact->job_title);
168 if (item->contact->company_name) 169 if (item->contact->company_name)
169 print_ldif_single("o", item->contact->company_name); 170 print_ldif_single("o", item->contact->company_name);
170 }
171 } 171 }
172 if (item->contact->address1 && *item->contact->address1) 172 if (item->contact->address1 && *item->contact->address1)
173 print_ldif_single("mail", item->contact->address1); 173 print_ldif_single("mail", item->contact->address1);
174 if (item->contact->address2 && *item->contact->address2) 174 if (item->contact->address2 && *item->contact->address2)
175 print_ldif_single("mail", item->contact->address2); 175 print_ldif_single("mail", item->contact->address2);
638 printf("dn: %s\n", ldap_base); 638 printf("dn: %s\n", ldap_base);
639 printf("o: %s\n", ldap_org); 639 printf("o: %s\n", ldap_org);
640 printf("objectClass: organization\n\n"); 640 printf("objectClass: organization\n\n");
641 printf("dn: cn=root, %s\n", ldap_base); 641 printf("dn: cn=root, %s\n", ldap_base);
642 printf("cn: root\n"); 642 printf("cn: root\n");
643 printf("sn: root\n");
643 for (vector<string>::size_type i=0; i<ldap_class.size(); i++) 644 for (vector<string>::size_type i=0; i<ldap_class.size(); i++)
644 print_ldif_single("objectClass", ldap_class[i].c_str()); 645 print_ldif_single("objectClass", ldap_class[i].c_str());
645 printf("\n"); 646 printf("\n");
646 } 647 }
647 } 648 }
709 while (*value == ' ') 710 while (*value == ' ')
710 value++; 711 value++;
711 712
712 print_escaped_dn(value); 713 print_escaped_dn(value);
713 if (base && base[0]) { 714 if (base && base[0]) {
714 printf(","); 715 printf(", %s", base);
715 print_escaped_dn(base);
716 } 716 }
717 printf("\n"); 717 printf("\n");
718 return; 718 return;
719 } 719 }
720 720
761 printf("\\%2.2X", ch & 0xFF); 761 printf("\\%2.2X", ch & 0xFF);
762 else switch (ch) { 762 else switch (ch) {
763 case '\\': 763 case '\\':
764 case '"' : 764 case '"' :
765 case '+' : 765 case '+' :
766 case ',' :
766 case ';' : 767 case ';' :
767 case '<' : 768 case '<' :
768 case '>' : 769 case '>' :
769 putchar('\\'); 770 putchar('\\');
770 // Fall through 771 // Fall through