Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Oracle - Netscape C linking problem
I've been working to allow oracle authentication on Netscape Enterprise server 3.62 with oracle 7.3.2
I've got the programming done but no matter how hard I try I cant get the program to compile and link correctly. I went all through oracle.mk and tried to jimmy it to work, with absolutely no luck.
below is a copy on my program. If anyone could possibly help out with getting the make file correct so that I can run this it would be a life saver.
#ifdef XP_WIN32
#define NSAPI_PUBLIC __declspec(dllexport)
#else /* !XP_WIN32 */
#define NSAPI_PUBLIC
#endif /* !XP_WIN32 */
#include "pblock.h"
#include "session.h"
#include "req.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <oratypes.h>
/* LDA and CDA struct declarations */
#include <ocidfn.h>
#ifdef __STDC__
#include <ociapr.h>
#else
#include <ocikpr.h>
#endif
#include <ocidem.h>
/* oparse flags */
#define DEFER_PARSE 1
#define NATIVE 1
#define VERSION_7 2
text *ousername = (text *) "<user>@<tns>"; text *opassword = (text *) "<password>";
/* Define an LDA, a HDA, and one cursor. */
Lda_Def lda;
ub4 hda[HDA_SIZE/sizeof(ub4)];
Cda_Def cda1;
#include "log.h"
void do_exit();
NSAPI_PUBLIC int auth(pblock *param, Session *sn, Request *rq) {
/* Parameters given to us by auth-basic */
char *pwfile = pblock_findval("userdb", param); char *user = pblock_findval("user", param); char *pw = pblock_findval("pw", param);char select[400];
if (olog(&lda, (ub1 *)hda, ousername, -1, opassword, -1,(text *) 0, -1, (ub4)OCI_LM_DEF))
{
log_error(LOG_SECURITY, "auth", sn, rq, "Connection to Oracle failed
ORA-%d",cda1.rc);
return REQ_NOACTION;
}
if (oopen(&cda1, &lda, (text *) 0, -1, -1, (text *) 0, -1))
{
log_error(LOG_SECURITY, "auth", sn, rq, "Failed to open Oracle cursor
ORA-%d",cda1.rc);
do_exit(EXIT_FAILURE);
return REQ_NOACTION;
}
/* This query is send to Oracle */
sprintf(select,"select count(*) from SUMMER_ACTS_OWNER.auth where
username='%s' and password='%s' and groups '%s'",user,pw
,pwfile);
/* DEBUG INFO */ log_error(LOG_SECURITY, select, sn, rq, "Code Line: 1111 ORA-%d",cda1.rc);
if (oparse(&cda1, ((text *)select), (sb4) -1, DEFER_PARSE, (ub4) VERSION_7)) {
log_error(LOG_SECURITY, "auth", sn, rq, "Parsing SQL failed ORA-%d",cda1.rc);
do_exit(EXIT_FAILURE);
return REQ_NOACTION;
}
if (odefin(&cda1, 1, (ub1 *) &empno, (sword) sizeof(sword),(sword)
INT_TYPE, \
(sword) -1, (sb2 *) 0, (text *) 0, -1, -1, (ub2 *) 0, (ub2 *) 0))
{
log_error(LOG_SECURITY, "auth", sn, rq, "Resultset definition failed ORA-%d",cda1.rc);
do_exit(EXIT_FAILURE);
return REQ_NOACTION;
}
/* DEBUG INFO */ log_error(LOG_SECURITY, "ars_path", sn, rq, "Code Line: 2222 ORA-%d",cda1.rc);
if (oexfet(&cda1, (ub4) 1, FALSE, FALSE)) { log_error(LOG_SECURITY, "auth", sn, rq, "Code Line: 3333 ORA-%d",cda1.rc);
do_exit(EXIT_FAILURE); return REQ_NOACTION;
if (empno != 1)
{
/* DEBUG INFO */ log_error(LOG_SECURITY, "auth", sn, rq, "Oracle found 0
or more then 1 user: %d ORA-%d",empno,cda1.rc);
do_exit(EXIT_FAILURE); return REQ_NOACTION;
return REQ_PROCEED;
void do_exit(exit_code)
sword exit_code;
{
sword error = 0;
if (oclose(&cda1))
{
error++;
}
if (ologof(&lda))
{
error++;
}
if (error == 0 && exit_code == EXIT_SUCCESS)
exit(exit_code);
}
Thanks
Bill
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon May 01 2000 - 00:00:00 CDT
![]() |
![]() |