return( 0 );
}
+int
+tool_is_oid( const char *s )
+{
+ int first = 1;
+
+ if ( !isdigit( s[ 0 ] ) ) {
+ return 0;
+ }
+
+ for ( ; s[ 0 ]; s++ ) {
+ if ( s[ 0 ] == '.' ) {
+ if ( s[ 1 ] == '\0' ) {
+ return 0;
+ }
+ first = 1;
+ continue;
+ }
+
+ if ( !isdigit( s[ 0 ] ) ) {
+ return 0;
+ }
+
+ if ( first == 1 && s[ 0 ] == '0' && s[ 1 ] != '.' ) {
+ return 0;
+ }
+ first = 0;
+ }
+
+ return 1;
+}
+
char **refs ));
void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
+int tool_is_oid LDAP_P(( const char *s ));
LDAP_END_DECL
return 0;
}
-static int
-is_oid( const char *s )
-{
- int first = 1;
-
- if ( !isdigit( s[ 0 ] ) ) {
- return 0;
- }
-
- for ( ; s[ 0 ]; s++ ) {
- if ( s[ 0 ] == '.' ) {
- if ( s[ 1 ] == '\0' ) {
- return 0;
- }
- first = 1;
- continue;
- }
-
- if ( !isdigit( s[ 0 ] ) ) {
- return 0;
- }
-
- if ( first == 1 && s[ 0 ] == '0' && s[ 1 ] != '.' ) {
- return 0;
- }
- first = 0;
- }
-
- return 1;
-}
-
static int parse_page_control(
LDAP *ld,
LDAPMessage *result,
}
if ( crit ) ldapsync *= -1;
- } else if ( is_oid( control ) ) {
+ } else if ( tool_is_oid( control ) ) {
if ( ctrl_add() ) {
exit( EXIT_FAILURE );
}