Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ticket 47531 - Mozldap - need to rewrite sasl_io_recv
Bug Description: Mozldap does not have some "ber" functions (ber_skip_element) that are in openldap. This causes the build to fail. Fix Description: To parse the ber we need a local copy of the ber structure(which I called MozElement), so that the ber_ptr can be manipulated. I had to use a new header file(mozldap.h), because the mozldap BerElement typedef's caused build failures. There is also a mozldap version check, and if the verison is newer than what was used for mozldap.h, the build will fail. The current internal version is 604, even though the rpm says 605. https://fedorahosted.org/389/ticket/47531 Reviewed by: richm(Thanks!)
- Loading branch information
1 parent
92f9e83
commit 62c89ea
Showing
2 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* mozldap does not have all the openldap "ber" functions, like ber_skip_element. | ||
* So we need to directly parse the ber element, and see inside the ber struct. | ||
* From lber-int.h | ||
*/ | ||
typedef struct seqorset { | ||
ber_len_t sos_clen; | ||
ber_tag_t sos_tag; | ||
char *sos_first; | ||
char *sos_ptr; | ||
struct seqorset *sos_next; | ||
} Seqorset; | ||
|
||
#define SOS_STACK_SIZE 8 /* depth of the pre-allocated sos structure stack */ | ||
#define MAX_TAG_SIZE (1 + sizeof(ber_int_t)) /* One byte for the length of the tag */ | ||
#define MAX_LEN_SIZE (1 + sizeof(ber_int_t)) /* One byte for the length of the length */ | ||
#define MAX_VALUE_PREFIX_SIZE (2 + sizeof(ber_int_t)) /* 1 byte for the tag and 1 for the len (msgid) */ | ||
#define BER_ARRAY_QUANTITY 7 /* 0:Tag 1:Length 2:Value-prefix 3:Value 4:Value-suffix */ | ||
|
||
struct berelement { | ||
ldap_x_iovec ber_struct[BER_ARRAY_QUANTITY]; /* See above */ | ||
char ber_tag_contents[MAX_TAG_SIZE]; | ||
char ber_len_contents[MAX_LEN_SIZE]; | ||
char ber_pre_contents[MAX_VALUE_PREFIX_SIZE]; | ||
char ber_suf_contents[MAX_LEN_SIZE+1]; | ||
char *ber_buf; /* update the value value when writing in case realloc is called */ | ||
char *ber_ptr; | ||
char *ber_end; | ||
struct seqorset *ber_sos; | ||
ber_len_t ber_tag_len_read; | ||
ber_tag_t ber_tag; /* Remove me someday */ | ||
ber_len_t ber_len; /* Remove me someday */ | ||
int ber_usertag; | ||
char ber_options; | ||
char *ber_rwptr; | ||
BERTranslateProc ber_encode_translate_proc; | ||
BERTranslateProc ber_decode_translate_proc; | ||
int ber_flags; | ||
#define LBER_FLAG_NO_FREE_BUFFER 1 /* don't free ber_buf */ | ||
unsigned int ber_buf_reallocs; /* realloc counter */ | ||
int ber_sos_stack_posn; | ||
Seqorset ber_sos_stack[SOS_STACK_SIZE]; | ||
}; | ||
typedef struct berelement MozElement; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters