LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 19th, 2004, 02:07 PM
ourumov ourumov is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 8 ourumov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem with ldap_get_values

Code:
	
	int tam,n_error;
	char buf[500],DN[500],contrassenya[500], error_l[500];
	char **tmp_buf;
	char *atr[]={"commonName","surname",NULL};
	LDAP *tmp_resp;
	LDAPMessage *res,*res_p;
...
...
...


if(tmp_resp!=NULL)
	{
		if((n_error=ldap_simple_bind_s(tmp_resp,DN,contrassenya))!=LDAP_SUCCESS)
		{
			close(sock);
			printf("%s",DN);
			printf("%s",contrassenya);
			printf("Failure\n");			
			return -1;
		}
		else
		{
			tam=sprintf(buf,"Correctament Autentificat\n");
			write(sock,buf,tam);

			if(ldap_search_s(tmp_resp, DN, LDAP_SCOPE_BASE, "(ObjectClass=*)",
			atr, 0, &res)==LDAP_SUCCESS)
			{
				
				if((res_p=ldap_first_entry(tmp_resp, res))!=NULL)
				{
					if((tmp_buf=(ldap_get_values(tmp_resp,res_p,(char*)&atr)))!=NULL)
					{	/*Anem copiant els valors a la Taula*/
						strcpy(taula_global[MAX].full_name,(char*)(&tmp_buf));
						taula_global[MAX].sock_name=sock;
						MAX++;
						if(MAX==50)MAX=0;
						printf("Usuari Afegit a Taula\n");

						if(ldap_unbind(tmp_resp)==LDAP_SUCCESS)
							return 0;
						else
							printf("Error al fer unbind\n");
					}
					else
						printf("Error al afegir a la Taula\n");
				}
				else
					printf("Error al Obtenir valors\n");
			}	
			
			else
				printf("La entrada no s'ha trobat\n");
		}
	}

I am doing a small job for the University and I have a problem when trying to get the values from the LDAP query I have previously done. Basically, the problem is that the function ldap_get_values returns NULL...
Any hints on what I am doing wrong ?

Thanks in Advance.

Last edited by ourumov : March 19th, 2004 at 02:11 PM.

Reply With Quote
  #2  
Old March 20th, 2004, 03:39 AM
ourumov ourumov is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 8 ourumov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I found the problem...changed commonName to cn and surname to sn and it worked. Anyways, thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesLDAP Programming > Problem with ldap_get_values


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway