Highlighted
Outstanding Contributor.
Outstanding Contributor.
562 views

mldap_search output error

Jump to solution

Hello, i'm using Vugen 12.52, and i try to create new script for testing several technology. This time i would like to check my LDAP querying it and compare the result to a known value to confirm that LDAP is working preperly.

here is my code:

// Search entry Dupont

mldap_search ("LDAP Search OpenLDAP",

"Base=dc=eforpro,dc=fr", "Scope=Base",

"Filter=(name=DUPONT)",

"Timeout=10", "Mode=ASYNC",

"SaveAsParam=True",

"Attrs=uid,mail",

LAST );

lr_output_message ("The uid value is: %d", lr_eval_string("{mldap_attribute_uid_0}"));

lr_output_message("The mail value is: %s", lr_eval_string("{mldap_attribute_mail_1}")); 

Here the output:

Action.c(24): The uid value is: 109972000

Action.c(25): The mail value is: {mldap_attribute_mail_1} 

I test with LDAPAdmin and it works, now i do not understand why line 25 return the variable name and not his value, in the meantime (as i'm not an expert of C), i do not understand the corresponding of the umerical value retrieve by the script. I would like to compare this value with one entry in my LDAP.

 

Thx for your help

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: mldap_search output error

Jump to solution

Hi

For the first question about UID returning as a number, is because you have the wrong format string, and use the wrong index. You should use "%s" here also, as lr_eval_string() always returns a "String". As it is now you are writing out the adress of the data. But if you change it, it will probably not work, as the index is 1-based, ie starts with 1 and goes to the number of hits.

For the second error, it is because {mldap_attribute_mail_1} have no value (or is unset), then it is written in out in full. It seems like your query did not return any results or that you should switch to SYNC, to get the results back.

For debugging, I would have set a breakpoint at the first lr_output_message and checked  the "Runtime Data"-tab in the bottom.

br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

 

 

 

 

.

View solution in original post

2 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: mldap_search output error

Jump to solution

Hi

For the first question about UID returning as a number, is because you have the wrong format string, and use the wrong index. You should use "%s" here also, as lr_eval_string() always returns a "String". As it is now you are writing out the adress of the data. But if you change it, it will probably not work, as the index is 1-based, ie starts with 1 and goes to the number of hits.

For the second error, it is because {mldap_attribute_mail_1} have no value (or is unset), then it is written in out in full. It seems like your query did not return any results or that you should switch to SYNC, to get the results back.

For debugging, I would have set a breakpoint at the first lr_output_message and checked  the "Runtime Data"-tab in the bottom.

br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

 

 

 

 

.

View solution in original post

Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: mldap_search output error

Jump to solution

Hello,

 

indeed my research does not return any value if i stay in ASYNC mode.

I had to remove the filter too, because nothing is return as soon as i specified i value into. Even with a valid uid reference.

I'll keep investigate because it's quite strange and i would like to understand 🙂

 

Anyway many thanks for your help

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.