Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 211091 Details for
Bug 222918
server crash after deleting supposedly deleted attribute
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
revised diff for string.c
string.c.diff (text/plain), 8.22 KB, created by
Noriko Hosoi
on 2007-09-28 23:13:13 UTC
(
hide
)
Description:
revised diff for string.c
Filename:
MIME Type:
Creator:
Noriko Hosoi
Created:
2007-09-28 23:13:13 UTC
Size:
8.22 KB
patch
obsolete
>Index: servers/plugins/syntaxes/string.c >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/syntaxes/string.c,v >retrieving revision 1.8 >diff -t -w -U4 -r1.8 string.c >--- servers/plugins/syntaxes/string.c 19 Sep 2007 19:32:03 -0000 1.8 >+++ servers/plugins/syntaxes/string.c 28 Sep 2007 23:10:01 -0000 >@@ -309,71 +309,68 @@ > int > string_values2keys( Slapi_PBlock *pb, Slapi_Value **bvals, > Slapi_Value ***ivals, int syntax, int ftype ) > { >- int nsubs, numbvals, i, n, j; >- Slapi_Value **nbvals; >+ int nsubs, numbvals = 0, n; >+ Slapi_Value **nbvals, **nbvlp; >+ Slapi_Value **bvlp; > char *w, *c, *p; >- char buf[SUBLEN+1]; > > switch ( ftype ) { > case LDAP_FILTER_EQUALITY: > /* allocate a new array for the normalized values */ >- for ( numbvals = 0; bvals[numbvals] != NULL; numbvals++ ) { >- /* NULL */ >+ for ( bvlp = bvals; bvlp && *bvlp; bvlp++ ) { >+ numbvals++; > } >- nbvals = (Slapi_Value **) slapi_ch_malloc( (numbvals+1) * sizeof(Slapi_Value *)); >+ nbvals = (Slapi_Value **) slapi_ch_calloc( (numbvals + 1), sizeof(Slapi_Value *)); > >- for ( i = 0; i < numbvals; i++ ) >+ for ( bvlp = bvals, nbvlp = nbvals; bvlp && *bvlp; bvlp++, nbvlp++ ) > { >- c = slapi_ch_strdup(slapi_value_get_string(bvals[i])); >+ c = slapi_ch_strdup(slapi_value_get_string(*bvlp)); > /* if the NORMALIZED flag is set, skip normalizing */ >- if (!(slapi_value_get_flags(bvals[i]) & SLAPI_ATTR_FLAG_NORMALIZED)) >+ if (!(slapi_value_get_flags(*bvlp) & SLAPI_ATTR_FLAG_NORMALIZED)) > value_normalize( c, syntax, 1 /* trim leading blanks */ ); >- nbvals[i] = slapi_value_new_string_passin(c); >+ *nbvlp = slapi_value_new_string_passin(c); > } >- nbvals[i] = NULL; > *ivals = nbvals; > break; > > case LDAP_FILTER_APPROX: > /* XXX should not do this twice! XXX */ > /* get an upper bound on the number of ivals */ >- numbvals = 0; >- for ( i = 0; bvals[i] != NULL; i++ ) { >- for ( w = first_word( (char*)slapi_value_get_string(bvals[i]) ); w != NULL; >- w = next_word( w ) ) { >+ for ( bvlp = bvals; bvlp && *bvlp; bvlp++ ) { >+ for ( w = first_word( (char*)slapi_value_get_string(*bvlp) ); >+ w != NULL; w = next_word( w ) ) { > numbvals++; > } > } >- nbvals = (Slapi_Value **) slapi_ch_malloc( (numbvals + 1) * sizeof(Slapi_Value *) ); >+ nbvals = (Slapi_Value **) slapi_ch_calloc( (numbvals + 1), sizeof(Slapi_Value *) ); > > n = 0; >- for ( i = 0; bvals[i] != NULL; i++ ) { >- for ( w = first_word( (char*)slapi_value_get_string(bvals[i]) ); w != NULL; >- w = next_word( w ) ) { >+ nbvlp = nbvals; >+ for ( bvlp = bvals; bvlp && *bvlp; bvlp++ ) { >+ for ( w = first_word( (char*)slapi_value_get_string(*bvlp) ); >+ w != NULL; w = next_word( w ) ) { > if ( (c = phonetic( w )) != NULL ) { >- nbvals[n] = slapi_value_new_string_passin(c); >- n++; >+ *nbvlp = slapi_value_new_string_passin(c); >+ nbvlp++; > } > } > } >- nbvals[n] = NULL; > >- if ( n == 0 ) { >- slapi_ch_free((void**)ivals ); >- return( 0 ); >- } >+ /* even if (n == 0), we should return the array nbvals w/ NULL items */ > *ivals = nbvals; > break; > > case LDAP_FILTER_SUBSTRINGS: > { > /* XXX should remove duplicates! XXX */ > Slapi_Value *bvdup; > const struct berval *bvp; >+ char buf[SUBLEN+1]; >+ int i; > nsubs = 0; >- for ( i = 0; bvals[i] != NULL; i++ ) { >+ for ( bvlp = bvals; bvlp && *bvlp; bvlp++ ) { > /* > * Note: this calculation may err on the high side, > * because value_normalize(), which is called below > * before we actually create the substring keys, may >@@ -383,29 +380,28 @@ > * be too big. Since the ivals array is NULL terminated, > * the only downside is that we allocate more space than > * we really need. > */ >- nsubs += slapi_value_get_length(bvals[i]) - SUBLEN + 3; >+ nsubs += slapi_value_get_length(*bvlp) - SUBLEN + 3; > } >- *ivals = (Slapi_Value **) slapi_ch_malloc( (nsubs + 1) * sizeof(Slapi_Value *) ); >+ *ivals = (Slapi_Value **) slapi_ch_calloc( (nsubs + 1), sizeof(Slapi_Value *) ); > > buf[SUBLEN] = '\0'; > n = 0; > > bvdup= slapi_value_new(); >- for ( i = 0; bvals[i] != NULL; i++ ) >- { >- c = slapi_ch_strdup(slapi_value_get_string(bvals[i])); >+ for ( bvlp = bvals; bvlp && *bvlp; bvlp++ ) { >+ c = slapi_ch_strdup(slapi_value_get_string(*bvlp)); > value_normalize( c, syntax, 1 /* trim leading blanks */ ); > slapi_value_set_string_passin(bvdup, c); > > bvp = slapi_value_get_berval(bvdup); > > /* leading */ > if ( bvp->bv_len > SUBLEN - 2 ) { > buf[0] = '^'; >- for ( j = 0; j < SUBLEN - 1; j++ ) { >- buf[j + 1] = bvp->bv_val[j]; >+ for ( i = 0; i < SUBLEN - 1; i++ ) { >+ buf[i + 1] = bvp->bv_val[i]; > } > (*ivals)[n] = slapi_value_new_string(buf); > n++; > } >@@ -413,10 +409,10 @@ > /* any */ > for ( p = bvp->bv_val; > p < (bvp->bv_val + bvp->bv_len - SUBLEN + 1); > p++ ) { >- for ( j = 0; j < SUBLEN; j++ ) { >- buf[j] = p[j]; >+ for ( i = 0; i < SUBLEN; i++ ) { >+ buf[i] = p[i]; > } > buf[SUBLEN] = '\0'; > (*ivals)[n] = slapi_value_new_string(buf); > n++; >@@ -424,18 +420,17 @@ > > /* trailing */ > if ( bvp->bv_len > SUBLEN - 2 ) { > p = bvp->bv_val + bvp->bv_len - SUBLEN + 1; >- for ( j = 0; j < SUBLEN - 1; j++ ) { >- buf[j] = p[j]; >+ for ( i = 0; i < SUBLEN - 1; i++ ) { >+ buf[i] = p[i]; > } > buf[SUBLEN - 1] = '$'; > (*ivals)[n] = slapi_value_new_string(buf); > n++; > } > } > slapi_value_free(&bvdup); >- (*ivals)[n] = NULL; > } > break; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222918
:
210881
| 211091 |
211111
|
213441
|
213451