summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2009-03-12 18:06:15 (UTC)
committer Michael Krelin <hacker@klever.net>2009-03-12 18:06:15 (UTC)
commita5804c83e1ff21fcbf3acb8b1ff952b8dc94adc1 (patch) (unidiff)
tree96bb224571c1a9a8f5a2a40f0da2655dbd7ee781
parentbfd588fc4793fc22834845eeb172b8e217c80dd1 (diff)
parente9a08ddbc451de3725293bf27ea90f579809af23 (diff)
downloadlibopkele-a5804c83e1ff21fcbf3acb8b1ff952b8dc94adc1.zip
libopkele-a5804c83e1ff21fcbf3acb8b1ff952b8dc94adc1.tar.gz
libopkele-a5804c83e1ff21fcbf3acb8b1ff952b8dc94adc1.tar.bz2
Merge commit 'devel.vz/next' into next
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--autoregen.sh2
-rw-r--r--test/RP.cc1
2 files changed, 3 insertions, 0 deletions
diff --git a/autoregen.sh b/autoregen.sh
new file mode 100644
index 0000000..ca4f880
--- a/dev/null
+++ b/autoregen.sh
@@ -0,0 +1,2 @@
1#!/bin/bash
2eval sh autogen.sh $(./config.status --version | grep '^ with options "'|sed -e 's/^[^"]\+"//' -e 's/"$//')
diff --git a/test/RP.cc b/test/RP.cc
index 35ee71d..f015723 100644
--- a/test/RP.cc
+++ b/test/RP.cc
@@ -1,67 +1,68 @@
1#include <uuid/uuid.h> 1#include <uuid/uuid.h>
2#include <iostream> 2#include <iostream>
3#include <cassert> 3#include <cassert>
4#include <cstdlib>
4#include <stdexcept> 5#include <stdexcept>
5#include <string> 6#include <string>
6#include <set> 7#include <set>
7#include <iterator> 8#include <iterator>
8using namespace std; 9using namespace std;
9#include <kingate/exception.h> 10#include <kingate/exception.h>
10#include <kingate/plaincgi.h> 11#include <kingate/plaincgi.h>
11#include <kingate/cgi_gateway.h> 12#include <kingate/cgi_gateway.h>
12#include <opkele/exception.h> 13#include <opkele/exception.h>
13#include <opkele/types.h> 14#include <opkele/types.h>
14#include <opkele/util.h> 15#include <opkele/util.h>
15#include <opkele/uris.h> 16#include <opkele/uris.h>
16#include <opkele/discovery.h> 17#include <opkele/discovery.h>
17#include <opkele/association.h> 18#include <opkele/association.h>
18#include <opkele/sreg.h> 19#include <opkele/sreg.h>
19using namespace opkele; 20using namespace opkele;
20#include <opkele/prequeue_rp.h> 21#include <opkele/prequeue_rp.h>
21#include <opkele/debug.h> 22#include <opkele/debug.h>
22 23
23#include "sqlite.h" 24#include "sqlite.h"
24#include "kingate_openid_message.h" 25#include "kingate_openid_message.h"
25 26
26#undef DUMB_RP 27#undef DUMB_RP
27 28
28#ifdef DUMB_RP 29#ifdef DUMB_RP
29# define DUMBTHROW throw opkele::dumb_RP(OPKELE_CP_ "This RP is dumb") 30# define DUMBTHROW throw opkele::dumb_RP(OPKELE_CP_ "This RP is dumb")
30#else 31#else
31# define DUMBTHROW (void)0 32# define DUMBTHROW (void)0
32#endif 33#endif
33 34
34class rpdb_t : public sqlite3_t { 35class rpdb_t : public sqlite3_t {
35 public: 36 public:
36 rpdb_t() 37 rpdb_t()
37 : sqlite3_t("/tmp/RP.db") { 38 : sqlite3_t("/tmp/RP.db") {
38 assert(_D); 39 assert(_D);
39 char **resp; int nrow,ncol; char *errm; 40 char **resp; int nrow,ncol; char *errm;
40 if(sqlite3_get_table( 41 if(sqlite3_get_table(
41 _D,"SELECT a_op FROM assoc LIMIT 0", 42 _D,"SELECT a_op FROM assoc LIMIT 0",
42 &resp,&nrow,&ncol,&errm)!=SQLITE_OK) { 43 &resp,&nrow,&ncol,&errm)!=SQLITE_OK) {
43 extern const char *__RP_db_bootstrap; 44 extern const char *__RP_db_bootstrap;
44 DOUT_("Bootstrapping DB"); 45 DOUT_("Bootstrapping DB");
45 if(sqlite3_exec(_D,__RP_db_bootstrap,NULL,NULL,&errm)!=SQLITE_OK) 46 if(sqlite3_exec(_D,__RP_db_bootstrap,NULL,NULL,&errm)!=SQLITE_OK)
46 throw opkele::exception(OPKELE_CP_ string("Failed to bootstrap SQLite database: ")+errm); 47 throw opkele::exception(OPKELE_CP_ string("Failed to bootstrap SQLite database: ")+errm);
47 }else 48 }else
48 sqlite3_free_table(resp); 49 sqlite3_free_table(resp);
49 50
50 } 51 }
51}; 52};
52 53
53class example_rp_t : public opkele::prequeue_RP { 54class example_rp_t : public opkele::prequeue_RP {
54 public: 55 public:
55 mutable rpdb_t db; 56 mutable rpdb_t db;
56 kingate::cookie htc; 57 kingate::cookie htc;
57 long as_id; 58 long as_id;
58 int ordinal; 59 int ordinal;
59 kingate::cgi_gateway& gw; 60 kingate::cgi_gateway& gw;
60 61
61 example_rp_t(kingate::cgi_gateway& g) 62 example_rp_t(kingate::cgi_gateway& g)
62 : as_id(-1), ordinal(0), gw(g), have_eqtop(false) { 63 : as_id(-1), ordinal(0), gw(g), have_eqtop(false) {
63 try { 64 try {
64 htc = gw.cookies.get_cookie("ht_session"); 65 htc = gw.cookies.get_cookie("ht_session");
65 as_id = opkele::util::string_to_long(gw.get_param("asid")); 66 as_id = opkele::util::string_to_long(gw.get_param("asid"));
66 }catch(kingate::exception_notfound& kenf) { 67 }catch(kingate::exception_notfound& kenf) {
67 uuid_t uuid; uuid_generate(uuid); 68 uuid_t uuid; uuid_generate(uuid);