int dm_Delete_entry() { extern int rfrl_msg; int status; struct DSError error; fillMostRmArg(); rmarg.rma_object = str2dn(plp->name); rfrl_msg = TRUE; status = REFERRAL; (void) printf("%s %s... ", del_entry, please_wait ); (void) fflush(stdout); while (status == REFERRAL) { status = ds_removeentry(&rmarg, &error); if (status != DS_OK) { rfrl_msg = FALSE; status = check_error(error); if (status != REFERRAL) { (void) printf(delete_failure); return OK; } } else { (void) printf(done); } } rfrl_msg = TRUE; return OK; }
struct ds_search_arg * fillMostOrgSearchArgs (char *cstr, int searchdepth) { static struct ds_search_arg arg; Attr_Sequence * atl; AttributeType at; struct namelist * x; static CommonArgs sca = default_common_args; arg.sra_common = sca; /* struct copy */ arg.sra_common.ca_servicecontrol.svc_timelimit = SVC_NOTIMELIMIT; arg.sra_common.ca_servicecontrol.svc_sizelimit= SVC_NOSIZELIMIT; arg.sra_subset = searchdepth; if (strcmp(cstr, "root") == 0) arg.sra_baseobject = NULLDN; else arg.sra_baseobject = str2dn(cstr); arg.sra_searchaliases = TRUE; /* specify attributes of interest */ arg.sra_eis.eis_allattributes = FALSE; atl = &(arg.sra_eis.eis_select); for (x = orgatts; x != NULLLIST; x = x->next) { if ((at = str2AttrT(x->name)) == NULLAttrT) continue; *atl = as_comp_alloc(); (*atl)->attr_type = at; (*atl)->attr_value = NULLAV; atl = &(*atl)->attr_link; } *atl = NULLATTR; arg.sra_eis.eis_infotypes = EIS_ATTRIBUTESANDVALUES; return (&arg); }
int dsa_control (Attr_Sequence as, struct DSError *error, DN dn) { char * str; DN dn2; Entry theentry; extern Entry database_root; SFD attempt_restart(); if ( ! manager(dn) ) { error->dse_type = DSE_SECURITYERROR; error->ERR_SECURITY.DSE_sc_problem = DSE_SC_ACCESSRIGHTS; return (DS_ERROR_REMOTE); } str = (char *) as->attr_value->avseq_av.av_struct; #ifndef NO_STATS LLOG (log_stat,LLOG_NOTICE,("DSA control: %s",str)); #endif switch (*str) { case 'd': /* -dump <directory> */ str = SkipSpace (++str); /* directory_dump (str, database_root); */ return (DS_OK); case 't': /* -tailor <string> */ str = SkipSpace (++str); if (dsa_tai_string (str) == OK) { isodexport (NULLCP); return (DS_OK); } break; case 'a': /* -abort */ LLOG (log_dsap,LLOG_FATAL,("*** abort signal ***")); dsa_abort(-1); exit(0); case 'b': /* -restart */ LLOG (log_dsap,LLOG_FATAL,("*** restart signal ***")); attempt_restart (NOTOK); exit(0); /* should not be reached */ case 'r': /* -refresh <entry> */ str = SkipSpace (++str); if (lexequ (str,"root") == 0) dn2= NULLDN; else if ((dn2 = str2dn (str)) == NULLDN) break; if (refresh_from_disk (dn2) == OK) return (DS_OK); break; case 'f': /* -resync <entry> */ str = SkipSpace (++str); if (lexequ (str,"root") == 0) dn2= NULLDN; else if ((dn2 = str2dn (str)) == NULLDN) break; if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) #ifdef TURBO_DISK { Entry akid = (Entry) avl_getone(theentry->e_children); if (turbo_writeall (akid) == OK) return (DS_OK); } #else { Entry akid = (Entry) avl_getone(theentry->e_children); if (journal (akid) == OK) return (DS_OK); } #endif break; case 'l': /* -lock <entry> */ str = SkipSpace (++str); if (lexequ (str,"root") == 0) dn2 = NULLDN; else if ((dn2 = str2dn (str)) == NULLDN) break; if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) { theentry->e_lock = TRUE; return (DS_OK); } break; case 'u': /* -unlock <entry> */ str = SkipSpace (++str); if (lexequ (str,"root") == 0) dn2 = NULLDN; else if ((dn2 = str2dn (str)) == NULLDN) break; if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) { theentry->e_lock = FALSE; return (DS_OK); } break; case 's': /* -slave */ /* * When we go async return of OK will mean that a getedb * operation has been scheduled, NOT that it has succeeded. */ str = SkipSpace (++str); if (*str == NULL) { slave_update(); return DS_OK; } if (lexequ (str, "shadow") == 0) { shadow_update(); return DS_OK; } if (lexequ (str, "root") == 0) dn2 = NULLDN; else if ((dn2 = str2dn (str)) == NULLDN) break; if (update_aux (dn2, dn2 == NULLDN) == OK) return DS_OK; break; default: break; } error->dse_type = DSE_SERVICEERROR; error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNWILLINGTOPERFORM; return (DS_ERROR_REMOTE); }
int new_dsa_control (Attr_Sequence as, struct DSError *error, DN dn) { struct dsa_control * item ; char * tmp_ptr ; DN dn2; Entry theentry; extern Entry database_root; SFD attempt_restart(); /* Return some silly error to distinguish it from the other dsa_control */ if ( ! manager(dn) ) { error->dse_type = DSE_SECURITYERROR ; error->ERR_SECURITY.DSE_sc_problem = DSE_SC_PROTECTIONREQUIRED ; return (DS_ERROR_REMOTE) ; } item = (struct dsa_control *) as->attr_value->avseq_av.av_struct ; switch (item->dsa_control_option) { case (CONTROL_CHANGETAILOR) : { /* -tailor <string> */ tmp_ptr = qb2str(item->un.changeTailor) ; if (dsa_tai_string (tmp_ptr) == OK) { isodexport (NULLCP); return (DS_OK); } break; } case(CONTROL_STOPDSA): { /* -abort */ LLOG(log_dsap,LLOG_FATAL,("*** abort signal ***")) ; stop_listeners() ; exit(0) ; } case (CONTROL_REFRESH): { /* -refresh <entry> */ if (item->un.refresh->offset == DN_PRESENT) if (refresh_from_disk (item->un.refresh->un.selectedDN) == OK) return (DS_OK); break; } case(CONTROL_RESYNCH): { /* -resync <entry> */ if (item->un.resynch->offset == DN_PRESENT) dn2 = item->un.resynch->un.selectedDN ; else break ; if ((theentry = local_find_entry (dn2, FALSE)) != NULLENTRY) #ifdef TURBO_DISK { Entry akid = (Entry) avl_getone(theentry->e_children); if (turbo_writeall (akid) == OK) return (DS_OK); } #else { Entry akid = (Entry) avl_getone(theentry->e_children); if (journal (akid) == OK) return (DS_OK); } #endif break; } case (CONTROL_LOCKDSA): { /* -lock <entry> */ if (item->un.resynch->offset == DN_PRESENT) dn2 = item->un.resynch->un.selectedDN ; else break ; if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) { theentry->e_lock = TRUE; return (DS_OK); } break; } case (CONTROL_UNLOCK): { /* -unlock <entry> */ if (item->un.resynch->offset == DN_PRESENT) dn2 = item->un.resynch->un.selectedDN ; else break ; if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) { theentry->e_lock = FALSE; return (DS_OK); } break; } case (CONTROL_SETLOGLEVEL): { /* Set the Logging Level */ tmp_ptr = qb2str(item->un.setLogLevel) ; /* What kind of stuff is needed here?!! */ return (DS_OK); break; } case (CONTROL_UPDATESLAVEEDBS): { /* -slave */ /* * When we go async return of OK will mean that a getedb * operation has been scheduled, NOT that it has succeeded. */ tmp_ptr = qb2str(item->un.updateSlaveEDBs) ; if (lexequ (tmp_ptr, "all") == 0) { slave_update(); return DS_OK; } if (lexequ (tmp_ptr, "shadow") == 0) { shadow_update(); return DS_OK; } if (lexequ (tmp_ptr, "root") == 0) { dn2 = NULLDN; } else { if ((dn2 = str2dn (tmp_ptr)) == NULLDN) break; } if (update_aux (dn2, dn2 == NULLDN) == OK) return DS_OK; break; } default: break; } error->dse_type = DSE_SERVICEERROR; error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNWILLINGTOPERFORM; return (DS_ERROR_REMOTE); }
dsEnqError list_start() { struct ds_search_arg search_arg; struct ds_search_result result; struct DSError error; dsEnqError return_error; return_error = Okay; if (get_default_service (&search_arg.sra_common) != 0) { return localdsaerror; } search_arg.sra_common.ca_servicecontrol.svc_options = SVC_OPT_PREFERCHAIN; search_arg.sra_baseobject = (*base_path != 'T'? str2dn (base_path): NULLDN); search_arg.sra_eis.eis_allattributes = FALSE; search_arg.sra_eis.eis_infotypes = EIS_ATTRIBUTETYPESONLY; search_arg.sra_eis.eis_select = 0; search_arg.sra_searchaliases = TRUE; search_arg.sra_subset = SRA_ONELEVEL; search_arg.sra_filter = filter_alloc(); search_arg.sra_filter->flt_type = FILTER_NOT; search_arg.sra_filter->flt_next = NULLFILTER; search_arg.sra_filter->flt_un.flt_un_filter = filter_alloc(); search_arg.sra_filter->flt_un.flt_un_filter->flt_type = FILTER_ITEM; search_arg.sra_filter->flt_un.flt_un_filter->flt_next = NULLFILTER; search_arg.sra_filter->flt_un.flt_un_filter->flt_un.flt_un_item.fi_type = FILTERITEM_EQUALITY; search_arg.sra_filter->flt_un.flt_un_filter->flt_un.flt_un_item.fi_un. fi_un_ava.ava_type = AttrT_new("2.5.4.0"); search_arg.sra_filter->flt_un.flt_un_filter->flt_un.flt_un_item.fi_un. fi_un_ava.ava_value = str2AttrV("dsa", search_arg.sra_filter->flt_un.flt_un_filter-> flt_un.flt_un_item.fi_un.fi_un_ava.ava_type-> oa_syntax); #ifndef NO_STATS LLOG (log_stat,LLOG_NOTICE,("search +%s,extent %d, val objectClass != dsa", base_path,search_arg.sra_subset)); #endif if (search_arg.sra_filter->flt_un.flt_un_filter->flt_un.flt_un_item. fi_un.fi_un_ava.ava_value == NULLAttrV) { return_error = localdsaerror; } else if (ds_search (&search_arg, &error, &result) != DS_OK) { free_seq(dnseq); dnseq = NULLDS; dn_number = 0; log_ds_error(&error); ds_error_free(&error); switch (error.dse_type) { case DSE_LOCALERROR: return_error = duaerror; break; case DSE_REMOTEERROR: return_error = localdsaerror; break; case DSE_ATTRIBUTEERROR: return_error = attributerror; break; case DSE_REFERRAL: case DSE_DSAREFERRAL: return_error = remotedsaerror; break; case DSE_SECURITYERROR: return_error = security; break; case DSE_NAMEERROR: return_error = namerror; break; case DSE_SERVICEERROR: return_error = serviceerror; break; default: return_error = localdsaerror; break; } } else { dn_number = 0; if (result.CSR_entries != NULLENTRYINFO) { register EntryInfo *ptr; free_seq(dnseq); dnseq = NULLDS; dn_number = 0; for (ptr = result.CSR_entries; ptr != NULLENTRYINFO; ptr = ptr->ent_next) { dn_number++; dn2buf ((caddr_t)ptr->ent_dn, goto_path); add_seq (&dnseq, goto_path); } if (dn_number) dnseq = SortList(dnseq); } else if (result.CSR_limitproblem == LSR_NOLIMITPROBLEM) { free_seq(dnseq); dnseq = NULLDS; dn_number = 0; return_error = nothingfound; } if (result.CSR_limitproblem != LSR_NOLIMITPROBLEM) { switch (result.CSR_limitproblem) { case LSR_TIMELIMITEXCEEDED: if (dn_number > 0) return_error = timelimit_w_partial; else { free_seq(dnseq); dnseq = NULLDS; return_error = timelimit; } break; case LSR_SIZELIMITEXCEEDED: return_error = listsizelimit; break; case LSR_ADMINSIZEEXCEEDED: if (dn_number > 0) return_error = adminlimit_w_partial; else { free_seq(dnseq); dnseq = NULLDS; return_error = adminlimit; } break; } } if (result.CSR_entries) entryinfo_free(result.CSR_entries, 0); } entry_number = dn_number; filter_free(search_arg.sra_filter); dn_free(search_arg.sra_baseobject); ds_error_free(&error); return return_error; }
main() { struct passwd *pw_entry ; struct passwd *getpwuid() ; struct stat buf ; int i = 1 ; int uid ; int um ; char pass1[LINESIZE] ; char pass2[LINESIZE] ; char Read_in_Stuff[LINESIZE] ; char **vecptr ; char *tmpdraft ; char home_dir[LINESIZE] ; char *p, *part1, *part2 ; char quipurc_file[100] ; char tailor_file[100] ; char user_name[9] ; char *localptr = Local ; char print_format = EDBOUT ; EntryInfo *ptr ; static CommonArgs ca = default_common_args; vecptr = (char **) malloc(100) ; vecptr[0] = malloc (LINESIZE) ; (void) strcpy(vecptr[0], "showentry") ; (void) strcpy(pass1, "x") ; (void) strcpy(pass2, "y") ; tmpdraft = malloc (LINESIZE) ; (void) strcpy(tmpdraft, "/tmp/dish-") ; if ((opt = ps_alloc (std_open)) == NULLPS) fatal (-62, "ps_alloc failed"); if (std_setup (opt, stderr) == NOTOK) fatal (-63, "std_setup failed"); if ((rps = ps_alloc (std_open)) == NULLPS) fatal (-64, "ps_alloc 2 failed"); if (std_setup (rps, stdout) == NOTOK) fatal (-65, "std_setup 2 failed"); (void) strcpy(filterstring, "userid=") ; /* Sort out files, userids etc. */ uid=getuid() ; if ((pw_entry=getpwuid(uid)) == 0) { ps_printf(rps, "Who are you? (no name for your uid number)\n") ; exit(1) ; } (void) strcpy(user_name, pw_entry->pw_name) ; (void) strcat(tmpdraft, user_name) ; if (getenv("HOME") == 0) { ps_printf(rps, "No home directory?!!") ; (void) strcpy(home_dir, pw_entry->pw_dir) ; } else { (void) strcpy(home_dir, getenv("HOME")) ; } (void) strcpy(quipurc_file, home_dir) ; (void) strcat(quipurc_file, "/.quipurc") ; (void) strcpy(tailor_file, isodefile ("dishinit", 1)); Manager[0] = 0; Password[0] = 0; Local[0] = 0; (void) stat(tailor_file, &buf) ; (void) seteuid(buf.st_uid) ; /* set effective to enable */ /* us to read protected file */ if ((fp_tailor = fopen(tailor_file, "r")) == 0) { ps_print(rps, "Can't open Tailor File. Abort.\n") ; exit(1) ; } while (fgets (Read_in_Stuff, LINESIZE, fp_tailor) != 0) { if (!strcmp(Read_in_Stuff, "##Anything after this line is copied into the users ~/.quipurc file\n")) { break ; } p = SkipSpace (Read_in_Stuff); if (( *p == '#') || (*p == '\0')) continue; /* ignore comments and blanks */ part1 = p; if ((part2 = index (p,':')) == NULLCP) { ps_printf (opt,"Seperator missing '%s'. Ignoring..\n",p); } *part2++ = '\0'; part2 = TidyString (part2); if (lexequ(part1, "manager") == 0) { (void) strcpy(Manager, part2) ; } else if (lexequ(part1, "password") == 0) { (void) strcpy(Password, part2) ; } else if (lexequ(part1, "local") == 0) { (void) strcpy(Local, part2) ; } else { ps_printf(rps, "Error in tailor. What's a %s?\n", part1) ; } } (void) setuid(uid) ; /* Restore Userid to original user. */ /* create ~/.quipurc file. NB this does eradicate anything in there. * (Theoretically nothing.) */ if (Manager[0] == 0) { ps_print(rps, "Can't find out the managers name\n") ; exit(1) ; } if (Password[0] == 0) { ps_print(rps, "Can't find out the managers password\n") ; exit(1) ; } if (Local[0] == 0) { ps_print(rps, "Can't find out where to search\n") ; exit(1) ; } um = umask(0177) ; if ((fp_quipurc = fopen(quipurc_file, "w")) == 0) { ps_printf(rps, "Can't open ~/.quipurc. Aborting..\n") ; exit(1) ; } (void) umask(um) ; if ((fileps = ps_alloc(std_open)) == NULLPS) { fatal (-66, "ps_alloc 2 failed"); } if (std_setup (fileps, fp_quipurc) == NOTOK) { fatal (-67, "std_setup 2 failed"); } /* Sorting out the bind section */ quipu_syntaxes() ; /* set up the needed function pointers */ dsap_init(&i, &vecptr) ; (void) strcpy(bindarg.dba_passwd, Password) ; bindarg.dba_version = DBA_VERSION_V1988; bindarg.dba_passwd_len = strlen(bindarg.dba_passwd) ; if ((bindarg.dba_dn = str2dn (Manager)) == NULLDN) { ps_printf (opt,"Invalid Manager name %s (???!)\n",Manager) ; exit(1) ; } if (ds_bind (&bindarg, &binderr, &bindresult) != OK) { ps_printf(rps, "Can't bind as the manager.\n") ; exit(1); } /* Hopefully, should be successfully bound */ /* * We now call the search stuff with the right bits, to see if we can get a * match of uid='user_name'. Once there, we echo lots of information from * their entry out to the .quipurc file. * Hopefully there should only be one match. This assumes that ALL dir info * up to date, and that SG do not allow multiple users with the same login. */ /* set up the appropriate structures and defaults. */ search_arg.sra_common = ca; /* struct copy */ search_arg.sra_common.ca_servicecontrol.svc_sizelimit = 2 ; search_arg.sra_eis.eis_allattributes = FALSE ; search_arg.sra_searchaliases = FALSE; search_arg.sra_subset = SRA_ONELEVEL; search_arg.sra_eis.eis_infotypes = EIS_ATTRIBUTESANDVALUES ; search_arg.sra_eis.eis_select = NULLATTR ; search_arg.sra_eis.eis_allattributes = TRUE ; search_arg.sra_filter = filter_alloc() ; /* Default filter. */ search_arg.sra_filter->flt_next = NULLFILTER; search_arg.sra_filter->flt_type = FILTER_ITEM; search_arg.sra_filter->FUFILT = NULLFILTER; if (*localptr == '@') { localptr++; } if ((search_arg.sra_baseobject = str2dn(localptr)) == NULLDN) { ps_printf (opt,"Invalid sequence in username %s.\n", localptr); exit(1) ; } (void) strcat(filterstring, user_name) ; search_arg.sra_filter->flt_un.flt_un_item.fi_type = FILTERITEM_EQUALITY ; if ((search_arg.sra_filter->flt_un.flt_un_item.fi_un.fi_un_ava.ava_type = AttrT_new ("userid")) == NULLAttrT) { ps_printf(rps, "Oops, userid is not a valid attr type. ABORT!!\n") ; exit(1) ; } if ((search_arg.sra_filter->flt_un.flt_un_item.fi_un.fi_un_ava.ava_value = str2AttrV (user_name, search_arg.sra_filter->flt_un.flt_un_item.fi_un.fi_un_ava.ava_type->oa_syntax)) == NULLAttrV) { ps_printf(rps, "%s is not a valid attribute value.\n", user_name) ; } /* call search */ /* We now ought to be in the right place, and with the search stuff set, * ready to call search, and receive one (or no) entry back, which then * gets processed accordingly. */ if (ds_search (&search_arg, &search_error, &search_result) != DS_OK) { ps_printf(rps, "Search failed...\n") ; exit (1) ; /* This is not the same as coming back with */ /* message "search failed to find anything. */ } /* If the user does not exist in the DIT, print out the limited .quipurc * and the warning message, and allow the user to play DISH. */ if (search_result.CSR_entries == NULLENTRYINFO) { ps_printf(opt, "Unfortunately, you seem to have no entry in\n") ; ps_printf(opt, "the directory. Contact '%s' who should be able to help.\n", Manager) ; ps_printf(opt, "In the mean time, you can read, but not write.\n") ; } else { ptr = search_result.CSR_entries ; dn = dn_cpy(ptr->ent_dn) ; /* Essence of move user_name. */ /* collect the info and put it into current_entry */ /* Set up the desired attribute type to be read*/ /* from read.c */ if ((at = AttrT_new ("userPassword")) != NULLAttrT) { as_flag = as_merge (as_flag, as_comp_new (AttrT_cpy (at), NULLAV, NULLACL_INFO)); } else { ps_printf(rps, "Oops, Serious error. unknown attribute type 'userPassword'.\n") ; exit(1) ; } if ((current_entry = local_find_entry (dn, FALSE)) == NULLENTRY) { read_arg.rda_common = ca; /* struct copy */ read_arg.rda_object = dn; read_arg.rda_eis.eis_infotypes = EIS_ATTRIBUTESANDVALUES; read_arg.rda_eis.eis_allattributes = TRUE ; read_arg.rda_eis.eis_select = NULLATTR ; if (ds_read (&read_arg, &read_error, &read_result) != DS_OK) { ps_printf(rps, "We even seem to be having problems reading\n" ) ; ps_printf(rps, "an entry we searched and found!! HELP!!\n") ; exit(1) ; } if (read_result.rdr_entry.ent_attr == NULLATTR) { ps_printf(rps, "No attributes present. Even though\n") ; ps_printf(rps, "we found you by userid attribute!!! HELP!!\n") ; exit (1) ; } cache_entry (&(read_result.rdr_entry), read_arg.rda_eis.eis_allattributes, TRUE) ; } if ((current_entry = local_find_entry (dn, FALSE)) == NULLENTRY) { ps_printf(rps, "We still have nothing.Even after reading? Abort.\n") ; exit(1) ; } ps_printf(fileps, "username: "******"\n") ; ps_printf(fileps, "me: ") ; dn_print(fileps, dn, EDBOUT) ; ps_printf(fileps, "\n") ; /* now showattribute -nokey to display it. */ ps_printf(fileps, "password: "******"You need a password...\n") ; (void) strcpy(pass1, getpassword("Enter Password: "******"Re-enter password: "******"\nMismatch - Try again.\n") ; } } ps_printf(fileps, "%s\n", pass1) ; um = umask(0177) ; if ((fp_draft = fopen(tmpdraft, "w")) == 0) { ps_print(rps, "Can't open draft file... Abort.\n") ; exit(1) ; } (void) umask(um) ; (void) fprintf(fp_draft, "UserPassword = %s\n", pass1) ; (void) fprintf(fp_draft, "acl = self # write # attributes # acl $ userPassword\n") ; (void) fprintf(fp_draft, "acl = others # compare # attributes # acl $ userPassword\n\n") ; (void) fclose(fp_draft) ; if ((fp_draft = fopen (tmpdraft, "r")) == NULL) { ps_printf (opt, "Can't open draft entry %s\n", tmpdraft); exit(1) ; } entry_ptr = get_default_entry (NULLENTRY); #ifdef TURBO_DISK entry_ptr->e_attributes = fget_attributes (fp_draft); #else entry_ptr->e_attributes = get_attributes (fp_draft); #endif (void) fclose (fp_draft); mod_arg.mea_common = ca; /* struct copy */ mod_arg.mea_object = dn; for (moddn = dn ; moddn->dn_parent != NULLDN; moddn=moddn->dn_parent) ; entry_ptr->e_name = rdn_cpy (moddn->dn_rdn); /* add rdn as attribute */ avst = avs_comp_new (AttrV_cpy (&entry_ptr->e_name->rdn_av)); temp = as_comp_new (AttrT_cpy (entry_ptr->e_name->rdn_at), avst, NULLACL_INFO); entry_ptr->e_attributes = as_merge (entry_ptr->e_attributes, temp); for (as = entry_ptr->e_attributes; as != NULLATTR; as = as->attr_link) { emnew = NULLMOD; trail = as->attr_link; as->attr_link = NULLATTR; temp = current_entry->e_attributes; for (; temp != NULLATTR; temp = temp->attr_link) if (AttrT_cmp (as->attr_type, temp->attr_type) == 0) { /* found it - does it need changing ? */ if (avs_cmp (as->attr_value, temp->attr_value) != 0) emnew = modify_avs (as->attr_value, temp->attr_value,as->attr_type); break; } if (temp == NULLATTR) { emnew = em_alloc (); emnew->em_type = EM_ADDATTRIBUTE; emnew->em_what = as_cpy(as); emnew->em_next = NULLMOD; } if (emnew != NULLMOD) { mod_arg.mea_changes = ems_append (mod_arg.mea_changes,emnew); } as->attr_link = trail; } while (ds_modifyentry (&mod_arg, &mod_error) != DS_OK) { if (dish_error (opt, &mod_error) == 0) { ps_printf(rps,"We have a dish error. Bye.\n") ; entry_free (entry_ptr); exit(1) ; } mod_arg.mea_object = mod_error.ERR_REFERRAL.DSE_ref_candidates->cr_name; } ps_print (rps, "Modified "); dn_print (rps, dn, EDBOUT); ps_print (rps, "\n"); delete_cache (dn); /* re-cache when next read */ entry_free (entry_ptr); ems_part_free (mod_arg.mea_changes); } } while(fgets(Read_in_Stuff, LINESIZE, fp_tailor) != 0) { fputs(Read_in_Stuff, fp_quipurc) ; } (void) fclose(fp_quipurc) ; (void) fclose(fp_tailor) ; /* (void) fprintf(fp_quipurc, "dsap: local_dit \"%s\"\n", Local) ; (void) fprintf(fp_quipurc, "notype: acl\n") ; (void) fprintf(fp_quipurc, "notype: treestructure\n") ; (void) fprintf(fp_quipurc, "notype: masterdsa\n") ; (void) fprintf(fp_quipurc, "notype: slavedsa\n") ; (void) fprintf(fp_quipurc, "notype: objectclass\n") ; (void) fprintf(fp_quipurc, "cache_time: 30\n") ; (void) fprintf(fp_quipurc, "connect_time: 2\n") ; */ (void) ds_unbind() ; (void) unlink(tmpdraft) ; }
int move (char *arg) { extern int print_parse_errors; DN user_down (); DN str2dn_aux (); DN sequence_dn(); DN tmpdn; char * ptr; char alias = FALSE; int len; print_parse_errors = FALSE; if (*arg == '-') { print_parse_errors = TRUE; return (NOTOK); /* can't be a move if it starts with a minus */ } if (*arg == '+') arg++; /* old style call */ ptr = arg; while (*ptr != 0) { if (! isdigit (*ptr)) break; ptr++; } if (*ptr == 0) { /* sequence move */ dn_free (dn); dn = dn_cpy (sequence_dn(atoi(arg))); print_parse_errors = TRUE; if (dn == NULLDN) { ps_printf (OPT,"Invalid sequence number %s\n",arg); return (NOTOK); } else return (OK); } len = strlen(arg); if ((arg[0] == '<') && ( arg[len-1] == '>')) { dn_free(dn); dn = str2dn(arg); return (OK); } if ((ptr = index (arg,'@')) != NULLCP) { *ptr = 0; if (*arg == 0) { /* from root */ dn_free (dn); dn = NULLDN; *ptr ='@'; arg = ++ptr; if (*arg == 0) { print_parse_errors = TRUE; return (OK); /* @ -> move to root */ } if ((ptr = index (arg,'@')) != NULLCP) *ptr = 0; } } else { dn_free (dn); dn = dn_cpy (fixed_pos); } if (strcmp (arg,"..") == 0) { do { DN dnptr; DN trail; if (dn == NULLDN) { print_parse_errors = TRUE; ps_print (OPT, "Can't go back past root\n"); return (NOTOK); } if (dn->dn_parent == NULLDN) { dn_free (dn); dn = NULLDN; } else { for (dnptr = dn; dnptr->dn_parent != NULLDN; dnptr = dnptr->dn_parent) trail = dnptr; dn_comp_free (dnptr); trail->dn_parent = NULLDN; } if (ptr == NULLCP) { print_parse_errors = TRUE; return (OK); } arg = ++ptr; if ((ptr = index (arg,'@')) != NULLCP) *ptr = 0; } while (strcmp (arg,"..") == 0); } if (ptr != NULL) *ptr = '@'; if ((tmpdn = str2dn_aux (arg,&alias)) != NULLDN) { if (dn == NULLDN) dn = tmpdn; else { if (alias) { dn_free (dn); dn = tmpdn; } else dn_append (dn,tmpdn); } print_parse_errors = TRUE; return (OK); } else { print_parse_errors = TRUE; return (NOTOK); } }
dsa_init () { Attr_Sequence as, get_cacheEDB(); AttributeType manager; DN str2dn(); struct edb_info * dsainfo; AV_Sequence avs; Entry newentry; Entry my_entry; int real_unravel_attribute (); int real_check_schema (); char loadstate = TRUE; struct DSError error; Entry akid; check_dsa_known_oids (); unrav_fn = (IFP) real_unravel_attribute; schema_fn = (IFP) real_check_schema; restart_fn = (IFP) attempt_restart; if (( manager = AttrT_new (MANAGER_OID)) == NULLAttrT) fatal (-1,"Manager - unknown attribute - check oid tables"); LLOG (log_dsap,LLOG_NOTICE,("dsa name %s",mydsaname)); if ((mydsadn = str2dn (mydsaname)) == NULLDN) { fatal (-2,"Invalid dsa name"); } if ((my_entry = load_dsa_cache_entry (mydsadn)) == NULLENTRY) { if (parse_status != 0) fatal (-3,"Can't load EDB subtree holding my DSA entry"); if (database_root != NULLENTRY) fatal (-4,"Found EDB - but my DSA entry not in it!"); fatal (-4,"can't locate my DSA entry in local database!"); } else if (my_entry->e_data == E_TYPE_CACHE_FROM_MASTER) shadow_myentry (); if (get_entry_passwd (my_entry->e_attributes) == NULLCP) /* This is not a fatal error, but some remote operations may fail */ LLOG(log_dsap,LLOG_EXCEPTIONS,("Can't find my own PASSWORD")); if (dsa_real_attr) { if (as_cmp (my_entry->e_attributes,dsa_real_attr) != 0) { LLOG (log_dsap,LLOG_EXCEPTIONS, ("DSA.real entry inconsistent with EDB -- problem should fix itself later!")); as_free (my_entry->e_attributes); my_entry->e_attributes = as_cpy (dsa_real_attr); if (unravel_attribute (my_entry,&error) != OK) fatal (-82,"schema error in DSA entry"); } } else dsa_real_attr = as_cpy (my_entry->e_attributes); if (my_entry->e_dsainfo != NULLDSA) { /* get manager attribute */ if ((as = entry_find_type(my_entry,manager)) == NULLATTR ) fatal (-5,"Manager attribute missing in my own entry"); AttrT_free (manager); super_user = avs_cpy ((AV_Sequence)as->attr_value); if (quipu_ctx_supported(my_entry) < 5) { LLOG(log_dsap,LLOG_EXCEPTIONS,( "Adding QUIPU and/or Internet DSP to application context!!!")); set_context (my_entry); } my_entry->e_dsainfo->dsa_version = TidyString (strdup (quipuversion)); if (as = entry_find_type (my_entry,at_version)) if ( strcmp ( (char *) as->attr_value->avseq_av.av_struct, my_entry->e_dsainfo->dsa_version) != 0) { if (as->attr_value->avseq_av.av_struct) free (as->attr_value->avseq_av.av_struct); as->attr_value->avseq_av.av_struct = (caddr_t) strdup (my_entry->e_dsainfo->dsa_version); if (as = as_find_type (dsa_real_attr,at_version)) { if (as->attr_value->avseq_av.av_struct) free (as->attr_value->avseq_av.av_struct); as->attr_value->avseq_av.av_struct = (caddr_t) strdup (my_entry->e_dsainfo->dsa_version); } if (parse_status == 0) if (my_entry->e_data == E_DATA_MASTER) { if (my_entry->e_parent != NULLENTRY) my_entry->e_parent->e_edbversion = new_version(); LLOG (log_dsap,LLOG_NOTICE,("Updating version number")); #ifdef TURBO_DISK if (turbo_write(my_entry) != OK) fatal (-33,"self rewrite failed - check database"); #else akid = (Entry) avl_getone(my_entry->e_parent->e_children); if (journal (akid) != OK) fatal (-33,"self rewrite failed - check database"); #endif } else { write_dsa_entry(my_entry); } } } else fatal (-6,"No edbinfo attribute in my own entry"); if (parse_status != 0) loadstate = FALSE; for (avs = my_entry->e_dsainfo->dsa_attr ; avs != NULLAV; avs=avs->avseq_next) { if (avs->avseq_av.av_struct == NULL) continue; dsainfo = (struct edb_info *) avs->avseq_av.av_struct; if ((newentry = make_path (dsainfo->edb_name)) == NULLENTRY) continue; (void) subtree_load (newentry,dsainfo->edb_name); if (parse_status != 0) loadstate = FALSE; } if (loadstate == FALSE) fatal (-7,"DSA Halted"); if ((akid = (Entry) avl_getone(database_root->e_children)) != NULLENTRY ) database_root->e_data = akid->e_data; /* Load cached EDB files - if any */ if ((as = get_cacheEDB()) != NULLATTR) { (void) time (&timenow); for (avs = as -> attr_value; avs != NULLAV; avs = avs -> avseq_next) { if ((newentry = make_path ((DN)avs->avseq_av.av_struct)) == NULLENTRY) continue; newentry = subtree_load (newentry,(DN)avs->avseq_av.av_struct); /* Should timestamp using version number ! */ if (newentry) newentry->e_age = timenow; } } #ifndef TURBO_DISK free_phylinebuf(); /* Large buffer used in loading text database */ #endif return (OK); }
static arginit (char **vec) { int argp; char *ap; char **argptr, *args[4]; struct TSAPaddr *ta = NULL; if (pgmname = rindex (*vec, '/')) pgmname++; if (pgmname == NULL || *pgmname == NULL) pgmname = *vec; isodetailor (pgmname, 0); ll_hdinit (pgm_log, pgmname); quipu_syntaxes (); argp = 0; args[argp++] = pgmname; for (argptr = vec, argptr++; ap = *argptr; argptr++) { if (*ap == '-') switch (*++ap) { case 'a': case 'u': case 'p': if ((ap = *++argptr) == NULL || *ap == '-') break; continue; case 'c': if ((ap = *++argptr) == NULL || *ap == '-') break; args[argp++] = "-c"; args[argp++] = ap; break; default: continue; } break; } args[argp] = NULLCP; dsap_init (&argp, (argptr = args, &argptr)); userdn = NULLDN, passwd[0] = NULL; for (vec++; ap = *vec; vec++) { if (*ap == '-') switch (*++ap) { case 'a': if ((ap = *++vec) == NULL || *ap == '-') adios (NULLCP, "usage: %s -a address", pgmname); if ((ta = str2taddr (ap)) == NULLTA) adios (NULLCP, "bad address \"%s\"", ap); continue; case 'b': prebind++; continue; case 'd': debug++; continue; case 'c': if ((ap = *++vec) == NULL || *ap == '-') adios (NULLCP, "usage: %s -c DSA-name-or-address", pgmname); continue; case 'u': if ((ap = *++vec) == NULL || *ap == '-') adios (NULLCP, "usage: %s -u username", pgmname); if ((userdn = str2dn (*ap != '@' ? ap : ap + 1)) == NULLDN) adios (NULLCP, "invalid DN for username: %s", ap); bzero ((char *) ap, strlen (ap)); continue; case 'p': if ((ap = *++vec) == NULL || *ap == '-') adios (NULLCP, "usage: %s -p passwd", pgmname); strcpy (passwd, ap); bzero ((char *) ap, strlen (ap)); continue; default: adios (NULLCP, "unknown switch -%s", ap); } adios (NULLCP, "usage: %s [switches]", pgmname); } if (ta == NULL && (ta = str2taddr (ns_address)) == NULLTA) adios (NULLCP, "bad default address \"%s\"", ns_address); tas = *ta; /* struct copy */ if ((nps = ps_alloc (str_open)) == NULLPS) adios (NULLCP, "ps_alloc: out of memory"); if (str_setup (nps, NULLCP, 0, 0) == NOTOK) adios (NULLCP, "str_setup: %s", ps_error (ps -> ps_errno)); }
static DNS dase_interact (DNS dns, DN dn, char *s) { int i; struct type_DASE_Callback__REQ *req = NULL; struct element_DASE_3 **dp; struct type_DASE_Callback__RSP *rsp = NULL; struct type_DASE_Callback__RSP *rp; DNS ds, *dq; PE pe = NULLPE; if (dns == NULLDNS) return NULL; i = 0; for (ds = dns; ds; ds = ds -> dns_next) i++; if (i > 1) { struct dn_seq **base, **bp, **ep; if (base = (struct dn_seq **) malloc ((unsigned) (i * sizeof *base))) { ep = base; for (ds = dns; ds; ds = ds -> dns_next) *ep++ = ds; qsort ((char *) base, i, sizeof *base, dns_compar); bp = base; ds = dns = *bp++; while (bp < ep) { ds -> dns_next = *bp; ds = *bp++; } ds -> dns_next = NULL; free ((char *) base); } } if ((req = (struct type_DASE_Callback__REQ *) calloc (1, sizeof *req)) == NULL) { no_mem: ; advise (LLOG_EXCEPTIONS, NULLCP, "out of memory"); out: ; if (req) free_DASE_Callback__REQ (req); if (rsp) free_DASE_Callback__RSP (rsp); if (pe) pe_free (pe); dn_seq_free (dns); return NULL; } if ((req -> string = str2qb (s, strlen (s), 1)) == NULL) goto no_mem; dp = &req -> choices; for (; dns; dns = ds) { struct element_DASE_3 *d3; struct type_DASE_Pair *pair; if ((d3 = (struct element_DASE_3 *) calloc (1, sizeof *d3)) == NULL) goto no_mem; *dp = d3, dp = &d3 -> next; if ((pair = (struct type_DASE_Pair *) calloc (1, sizeof *pair)) == NULL) goto no_mem; d3 -> Pair = pair; dn_print (nps, dns -> dns_dn, EDBOUT); ps_print (nps, " "); *--nps -> ps_ptr = NULL, nps -> ps_cnt++; pair -> complete = str2qb (nps -> ps_base, strlen (nps -> ps_base), 1); nps -> ps_ptr = nps -> ps_base, nps -> ps_cnt = nps -> ps_bufsiz; ufn_dn_print_aux (nps, dns -> dns_dn, dn, 0); ps_print (nps, " "); *--nps -> ps_ptr = NULL, nps -> ps_cnt++; pair -> friendly = str2qb (nps -> ps_base, strlen (nps -> ps_base), 1); nps -> ps_ptr = nps -> ps_base, nps -> ps_cnt = nps -> ps_bufsiz; if (pair -> complete == NULL || pair -> friendly == NULL) goto no_mem; ds = dns -> dns_next; dn_free (dns -> dns_dn); free ((char *) dns); } dns = NULL; if (encode_DASE_Callback__REQ (&pe, 1, NULL, NULLCP, req) == NOTOK) { advise (LLOG_EXCEPTIONS, NULLCP, "encode_DASE_Callback__REQ: %s", PY_pepy); goto out; } if (pe2ps (ps, pe) == NOTOK) adios (NULLCP, "pe2ps: %s", ps_error (ps -> ps_errno)); PLOGP (pgm_log,DASE_Message, pe, "message", 0); free_DASE_Callback__REQ (req); req = NULL; pe_free (pe); if ((pe = ps2pe (ps)) == NULLPE) adios (NULLCP, "ps2pe: %s", ps_error (ps -> ps_errno)); if (decode_DASE_Callback__RSP (pe, 1, NULLIP, NULLVP, &rsp) == NOTOK) { advise (LLOG_EXCEPTIONS, NULLCP, "decode_DASE_Callback__RSP: %s", PY_pepy); goto out; } PLOGP (pgm_log,DASE_Message, pe, "message", 1); dq = &dns; for (rp = rsp; rp; rp = rp -> next) { char *cp; if ((ds = (struct dn_seq *) calloc (1, sizeof *ds)) == NULL) goto no_mem; *dq = ds, dq = &ds -> dns_next; if ((cp = qb2str (rp -> IA5String)) == NULL) goto no_mem; ds -> dns_dn = str2dn (cp); free (cp); } free_DASE_Callback__RSP (rsp); pe_free (pe); return dns; }
static dase_aux (struct type_DASE_Query__REQ *req) { int i; int vecp; char **vp; char *context, **vec; struct type_DASE_Query__RSP *rsp; struct element_DASE_0 *d0; struct element_DASE_1 *d1; envlist el; envlist en, *ep; DN *dn; DNS dns; PE pe; if ((rsp = (struct type_DASE_Query__RSP *) calloc (1, sizeof *rsp)) == NULL) { no_mem: ; adios (NULLCP, "out of memory"); } vec = NULL, el = NULL, context = NULL, dns = NULL; i = 1; for (d0 = req -> name; d0; d0 = d0 -> next) i++; if ((vec = (char **) calloc ((unsigned) i, sizeof *vec)) == NULL) goto no_mem; for (vp = vec, d0 = req -> name; d0; vp++, d0 = d0 -> next) if ((*vp = qb2str (d0 -> IA5String)) == NULL) goto no_mem; #ifdef STATS else advise (LLOG_NOTICE, NULLCP, "lookup: %s", *vp); #endif vecp = i - 1; el = NULL, ep = ⪙ for (d1 = req -> envlist; d1; d1 = d1 -> next) { struct type_DASE_Environment *ev = d1 -> Environment; struct element_DASE_2 *d2; struct dn_seq **dp; if ((en = (envlist) calloc (1, sizeof *en)) == NULL) goto no_mem; *ep = en, ep = &en -> Next; en -> Upper = ev -> upper; en -> Lower = ev -> lower; dp = &en -> Dns; for (d2 = ev -> path; d2; d2 = d2 -> next) { char *cp; struct dn_seq *ds; if ((ds = (struct dn_seq *) calloc (1, sizeof *ds)) == NULL) goto no_mem; *dp = ds, dp = &ds -> dns_next; if ((cp = qb2str (d2 -> IA5String)) == NULL) goto no_mem; if (*cp != '-') ds -> dns_dn = str2dn (cp); free (cp); if (*cp != '-' && ds -> dns_dn == NULLDN) { PY_advise (NULLCP, "bad DN in environment (%s)", cp); goto send_rsp; } } } if ((context = qb2str (req -> context)) == NULL) goto no_mem; #ifdef STATS advise (LLOG_NOTICE, NULLCP, "context: %s", context); #endif if (req -> userdn) { int changed = 0; char *cp; DN newdn; if ((cp = qb2str (req -> userdn)) == NULL) goto no_mem; #ifdef STATS advise (LLOG_NOTICE, NULLCP, "userdn: %s", cp); #endif if ((newdn = str2dn (*cp != '@' ? cp : cp + 1)) == NULLDN) { PY_advise (NULLCP, "bad DN for userdn (%s)", cp); free (cp); goto send_rsp; } if (!userdn || dn_cmp (userdn, newdn)) changed++; if (userdn) dn_free (userdn); userdn = newdn; free (cp); if (req -> passwd) { if ((cp = qb2str (req -> passwd)) == NULL) goto no_mem; if (strcmp (passwd, cp)) changed++; strcpy (passwd, cp); free (cp); } else { if (passwd[0]) changed++; passwd[0] = NULL; } if (isbound && changed) { ds_unbind (); isbound = 0; } } if (!isbound && bind_to_dsa () == NOTOK) goto send_rsp; PY_pepy[0] = NULL; pe = NULLPE; if (vecp == 1 && *vec[0] == '@') { static DN dnstat; if ((dnstat = str2dn (vec[0])) == NULLDN) { PY_advise (NULLCP, "invalid name"); goto send_rsp; } rsp -> value = name2psap (*(dn = &dnstat)); goto all_done; } if (!aet_match (vecp, vec, req -> interactive ? dase_interact : just_say_no, &dns, el, context)) { if (PY_pepy[0] == NULL) PY_advise (NULLCP, "unable to resolve name"); goto send_rsp; } if (dns == NULL) { PY_advise (NULLCP, "search failed to find anything"); goto send_rsp; } dn = NULL; if (dns -> dns_next) { if (req -> interactive) dnSelect (vec[0], &dns, dase_interact, el -> Dns); for (; dns; dns = dns -> dns_next) { dn = &dns -> dns_dn; if (rsp -> value = name2psap (*dn)) break; } } else { dn = &dns -> dns_dn; rsp -> value = name2psap (*dn); } all_done: ; if (dn) { encode_IF_DistinguishedName (&rsp -> name, 1, NULL, NULLCP,*dn); #ifdef STATS advise (LLOG_NOTICE, NULLCP, "answer: %s", dn2str (*dn)); #endif ufn_dn_print_aux (nps, *dn, NULLDN, 0); ps_print (nps, " "); *--nps -> ps_ptr = NULL, nps -> ps_cnt++; rsp -> friendly = str2qb (nps -> ps_base, strlen (nps -> ps_base), 1); nps -> ps_ptr = nps -> ps_base, nps -> ps_cnt = nps -> ps_bufsiz; dn_free (*dn); *dn = NULLDN; } send_rsp: ; if (PY_pepy[0]) { advise (LLOG_NOTICE, NULLCP, "diagnostic: %s", PY_pepy); if ((rsp -> diagnostic = str2qb (PY_pepy, strlen (PY_pepy), 1)) == NULL) goto no_mem; } if (encode_DASE_Query__RSP (&pe, 1, NULL, NULLCP, rsp) == NOTOK) adios (NULLCP, "encode_DASE_Query__RSP: %s", PY_pepy); if (pe2ps (ps, pe) == NOTOK) adios (NULLCP, "pe2ps: %s", ps_error (ps -> ps_errno)); PLOGP (pgm_log,DASE_Message, pe, "message", 0); free_DASE_Query__RSP (rsp); pe_free (pe); if (vec) { for (vp = vec; *vp; vp++) free (*vp); free ((char *) vec); } for (; el; el = en) { en = el -> Next; dn_seq_free (el -> Dns); free ((char *) el); } if (context) free (context); if (dns) dn_seq_free (dns); }
dsEnqError srch_start() { struct ds_search_arg search_arg; struct ds_search_result result; struct DSError error; dsEnqError return_error; extern Filter make_filter(); DN curr_rdn; if (*mvalue == '\0') { return list_start(); } if (get_default_service (&search_arg.sra_common) != 0) { return nothingfound; } search_arg.sra_common.ca_servicecontrol.svc_options = SVC_OPT_PREFERCHAIN; curr_rdn = search_arg.sra_baseobject = (*base_path != 'T'? str2dn (base_path): NULLDN); search_arg.sra_eis.eis_allattributes = FALSE; search_arg.sra_eis.eis_infotypes = EIS_ATTRIBUTETYPESONLY; search_arg.sra_eis.eis_select = 0; search_arg.sra_searchaliases = TRUE; search_arg.sra_subset = SRA_ONELEVEL; while (curr_rdn != NULLDN) { if (!strcmp(curr_rdn->dn_rdn->rdn_at->oa_ot.ot_stroid, "2.5.4.10")) { search_arg.sra_subset = SRA_WHOLESUBTREE; break; } curr_rdn = curr_rdn->dn_parent; } if ((search_arg.sra_filter = make_filter(filt_arr[typeindx])) == NULLFILTER) return duaerror; #ifndef NO_STATS LLOG (log_stat, LLOG_NOTICE, ("search +%s, extent %d, val %s", base_path,search_arg.sra_subset, mvalue)); #endif if(ds_search (&search_arg, &error, &result) != DS_OK) { /* deal with error */ free_seq(dnseq); dnseq = NULLDS; dn_number = 0; log_ds_error(&error); ds_error_free(&error); switch (error.dse_type) { case DSE_LOCALERROR: return_error = duaerror; break; case DSE_REMOTEERROR: return_error = localdsaerror; break; case DSE_ATTRIBUTEERROR: return_error = attributerror; break; case DSE_REFERRAL: case DSE_DSAREFERRAL: return_error = remotedsaerror; break; case DSE_SECURITYERROR: return_error = security; break; case DSE_NAMEERROR: return_error = namerror; break; case DSE_SERVICEERROR: return_error = serviceerror; break; default: return_error = localdsaerror; break; } } else { correlate_search_results (&result); dn_number = 0; if (result.CSR_entries != NULLENTRYINFO) { register EntryInfo *ptr; return_error = Okay; free_seq(dnseq); dnseq = NULLDS; dn_number = 0; for (ptr = result.CSR_entries; ptr != NULLENTRYINFO; ptr = ptr->ent_next){ dn_number++; dn2buf((caddr_t) ptr->ent_dn, goto_path); add_seq(&dnseq, goto_path); } if (dn_number) dnseq = SortList(dnseq); } else if (result.CSR_limitproblem == LSR_NOLIMITPROBLEM) { free_seq(dnseq); dnseq = NULLDS; dn_number = 0; return_error = nothingfound; } if(result.CSR_limitproblem != LSR_NOLIMITPROBLEM) { switch (result.CSR_limitproblem) { case LSR_TIMELIMITEXCEEDED: if (dn_number > 0) return_error = timelimit_w_partial; else { free_seq(dnseq); dnseq = NULLDS; return_error = timelimit; } break; case LSR_SIZELIMITEXCEEDED: return_error = listsizelimit; break; case LSR_ADMINSIZEEXCEEDED: if (dn_number > 0) return_error = adminlimit_w_partial; else { free_seq(dnseq); dnseq = NULLDS; return_error = adminlimit; } break; } entryinfo_free(result.CSR_entries, 0); } } entry_number = dn_number; filter_free(search_arg.sra_filter); dn_free(search_arg.sra_baseobject); ds_error_free(&error); return return_error; }