author | Michael Krelin <hacker@klever.net> | 2008-02-08 21:02:26 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-02-08 21:02:26 (UTC) |
commit | 9e902e373ba72fd8725c5a1ffdfdc0447b664369 (patch) (side-by-side diff) | |
tree | 5006b406209f13f684fbce235e470252386da818 /test/OP.cc | |
parent | a62ccf212acb27a092a48d3af8ee0bfb3efdb666 (diff) | |
download | libopkele-9e902e373ba72fd8725c5a1ffdfdc0447b664369.zip libopkele-9e902e373ba72fd8725c5a1ffdfdc0447b664369.tar.gz libopkele-9e902e373ba72fd8725c5a1ffdfdc0447b664369.tar.bz2 |
renamed basic_op class to basic_OP
and doxygenated basic_OP a bit.
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | test/OP.cc | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -140,49 +140,49 @@ class example_op_t : public opkele::verify_op { S = sqlite3_mprintf( "SELECT" " a_handle,a_type,a_secret,a_stateless," " strftime('%%s',a_etime) AS a_etime," " a_itime" " FROM assoc" " WHERE a_handle=%Q AND a_itime IS NULL" " AND datetime('now') < a_etime" " LIMIT 1", h.c_str() ); sqlite3_table_t T; int nr,nc; db.get_table(S,T,&nr,&nc); if(nr<1) throw opkele::failed_lookup(OPKELE_CP_ "couldn't retrieve valid unexpired assoc"); assert(nr==1); assert(nc==6); opkele::secret_t secret; opkele::util::decode_base64(T.get(1,2,nc),secret); return opkele::assoc_t(new opkele::association( "", h, T.get(1,1,nc), secret, strtol(T.get(1,4,nc),0,0), strtol(T.get(1,3,nc),0,0) )); } - string& alloc_nonce(string& nonce,bool stateless) { + string& alloc_nonce(string& nonce) { uuid_t uuid; uuid_generate(uuid); nonce += opkele::util::encode_base64(uuid,sizeof(uuid)); sqlite3_mem_t<char*> S = sqlite3_mprintf( "INSERT INTO nonces" " (n_once) VALUES (%Q)", nonce.c_str() ); db.exec(S); return nonce; } bool check_nonce(const string& nonce) { sqlite3_mem_t<char*> S = sqlite3_mprintf( "SELECT 1" " FROM nonces" " WHERE n_once=%Q AND n_itime IS NULL", nonce.c_str()); sqlite3_table_t T; int nr,nc; db.get_table(S,T,&nr,&nc); return nr>=1; } void invalidate_nonce(const string& nonce) { sqlite3_mem_t<char*> |