Click here to Skip to main content
15,889,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to convert char** to char array Pin
Gofur Halmurat11-Mar-08 2:48
Gofur Halmurat11-Mar-08 2:48 
GeneralRe: How to convert char** to char array Pin
Rajkumar R11-Mar-08 5:40
Rajkumar R11-Mar-08 5:40 
GeneralRe: How to convert char** to char array Pin
David Crow11-Mar-08 5:34
David Crow11-Mar-08 5:34 
GeneralBitmaps in View Pin
Anu_Bala11-Mar-08 1:28
Anu_Bala11-Mar-08 1:28 
GeneralRe: Bitmaps in View Pin
ptr_Electron11-Mar-08 1:52
ptr_Electron11-Mar-08 1:52 
GeneralRe: Bitmaps in View [modified] Pin
Rajkumar R11-Mar-08 2:02
Rajkumar R11-Mar-08 2:02 
GeneralRe: Bitmaps in View Pin
ptr_Electron11-Mar-08 2:06
ptr_Electron11-Mar-08 2:06 
GeneralLdap Auth Pin
ika211-Mar-08 1:28
ika211-Mar-08 1:28 
Hi,
I'm developing a tool to show several graphs. But only the users that have been succesfully authentificated by LDAP should see those graphs. I'm developing with MFC+Visual Studio 2003.
I'm not really sure how to do this. I've been reading for a while about LDAP but I'm not sure how to implement authentification by LDAP in my App.

This is just a test I have done doing copy&paste from other code, but it always returns err=0x31.

	LDAP* ld = NULL;<br />
    INT iRtn = 0; <br />
    INT connectSuccess = 0;<br />
    PCHAR pHost = NULL;<br />
	PCHAR userDN = NULL;<br />
	PCHAR pw = NULL;<br />
    ULONG version = LDAP_VERSION3;<br />
   // SecPkgContext_ConnectionInfo sslInfo;<br />
    LONG lv = 0;<br />
	CString strDomain;<br />
	CString strName;<br />
	CString strPass;<br />
    // Verify that the user passed a hostname.<br />
    GetDlgItem(IDC_DOMAIN)->GetWindowText(strDomain);<br />
	GetDlgItem(IDC_PASSWORD)->GetWindowText(strPass);<br />
    GetDlgItem(IDC_NAME)->GetWindowText(strName);<br />
	<br />
	CString dn = "CN=" + strName +",DM=" + strDomain;<br />
<br />
    // Create an LDAP session.<br />
    ld = ldap_open(pHost,0);<br />
    if (ld == NULL)<br />
		GetDlgItem(IDC_EDIT4)->SetWindowText("ldap_open failed");<br />
	else<br />
	{<br />
		GetDlgItem(IDC_EDIT4)->SetWindowText("ldap_open OK");<br />
		ld->ld_lberoptions = 0;<br />
<br />
		pw = new char [strPass.GetLength()+1];<br />
		strcpy (pw,(LPCTSTR)strPass);<br />
<br />
		userDN = new char [dn.GetLength()+1];<br />
		strcpy (userDN,(LPCTSTR)dn);<br />
<br />
		INT err = ldap_simple_bind_s( ld, userDN, pw );<br />
		CString error;<br />
		error.Format("%d", err);<br />
		GetDlgItem(IDC_EDIT4)->SetWindowText("simple bind returned " + error);<br />
	}<br />
<br />
<br />
<br />
<br />
	if (ld != NULL)<br />
      ldap_unbind_s(ld);<br />
<br />
	if(pHost!=NULL)<br />
		delete pHost;<br />
<br />
	if(userDN != NULL)<br />
		delete userDN;<br />
<br />
	if(pw != NULL)<br />
		delete pw;


Regards and sorry for my poor english
QuestionWeb Programming in C++? Pin
Wamuti11-Mar-08 0:22
Wamuti11-Mar-08 0:22 
GeneralRe: Web Programming in C++? Pin
Christian Graus11-Mar-08 0:26
protectorChristian Graus11-Mar-08 0:26 
GeneralRe: Web Programming in C++? Pin
Nemanja Trifunovic11-Mar-08 3:34
Nemanja Trifunovic11-Mar-08 3:34 
GeneralRe: Web Programming in C++? Pin
Wamuti11-Mar-08 21:12
Wamuti11-Mar-08 21:12 
GeneralRe: Web Programming in C++? Pin
Demian Panello11-Mar-08 2:58
Demian Panello11-Mar-08 2:58 
GeneralRe: Web Programming in C++? Pin
Nemanja Trifunovic11-Mar-08 3:37
Nemanja Trifunovic11-Mar-08 3:37 
QuestionHOW TO USE DLL FUNCTIONS Pin
bhat11-Mar-08 0:21
bhat11-Mar-08 0:21 
AnswerRe: HOW TO USE DLL FUNCTIONS Pin
Maxwell Chen11-Mar-08 0:23
Maxwell Chen11-Mar-08 0:23 
AnswerRe: HOW TO USE DLL FUNCTIONS Pin
CPallini11-Mar-08 0:27
mveCPallini11-Mar-08 0:27 
AnswerRe: HOW TO USE DLL FUNCTIONS Pin
Christian Graus11-Mar-08 0:37
protectorChristian Graus11-Mar-08 0:37 
AnswerRe: HOW TO USE DLL FUNCTIONS Pin
Rajkumar R11-Mar-08 6:11
Rajkumar R11-Mar-08 6:11 
Questionabout middle function Pin
savitri11-Mar-08 0:11
savitri11-Mar-08 0:11 
GeneralRe: about middle function Pin
Maxwell Chen11-Mar-08 0:16
Maxwell Chen11-Mar-08 0:16 
GeneralRe: about middle function Pin
Rajesh R Subramanian11-Mar-08 0:20
professionalRajesh R Subramanian11-Mar-08 0:20 
GeneralRe: about middle function Pin
Maxwell Chen11-Mar-08 0:22
Maxwell Chen11-Mar-08 0:22 
GeneralRe: about middle function Pin
savitri11-Mar-08 0:25
savitri11-Mar-08 0:25 
GeneralRe: about middle function Pin
CPallini11-Mar-08 0:25
mveCPallini11-Mar-08 0:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.