mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-29 23:22:35 +02:00
2014-08-17 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in 'web/rdcastmanager/Makefile.am' that caused the incorrect executable to be installed for 'rdcastmanager.cgi'. * Refactored SQL statements in 'lib/rdweb.cpp'.
This commit is contained in:
parent
330075f4ac
commit
173fe17013
@ -14393,3 +14393,7 @@
|
||||
* Updated 'get_distro.sh' to detect RHEL 7 correctly.
|
||||
* Modified the installation script to work on RHEL 7 in
|
||||
'rivendell.spec.in'.
|
||||
2014-08-17 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a regression in 'web/rdcastmanager/Makefile.am' that caused
|
||||
the incorrect executable to be installed for 'rdcastmanager.cgi'.
|
||||
* Refactored SQL statements in 'lib/rdweb.cpp'.
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <qdatetime.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <rdescape_string.h>
|
||||
#include <rduser.h>
|
||||
#include <rddb.h>
|
||||
#include <rdconf.h>
|
||||
@ -686,14 +687,11 @@ long int RDAuthenticateLogin(const QString &username,const QString &passwd,
|
||||
timeval=time(&timeval);
|
||||
srandom(timeval);
|
||||
long int session=random();
|
||||
QString sql=QString().sprintf("insert into WEB_CONNECTIONS set \
|
||||
SESSION_ID=%ld,\
|
||||
LOGIN_NAME=\"%s\",\
|
||||
IP_ADDRESS=\"%s\",\
|
||||
TIME_STAMP=now()",
|
||||
session,
|
||||
(const char *)username,
|
||||
(const char *)addr.toString());
|
||||
QString sql=QString("insert into WEB_CONNECTIONS set ")+
|
||||
QString().sprintf("SESSION_ID=%ld,",session)+
|
||||
"LOGIN_NAME=\""+RDEscapeString(username)+"\","+
|
||||
"IP_ADDRESS=\""+addr.toString()+"\","+
|
||||
"TIME_STAMP=now()";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
@ -703,25 +701,25 @@ long int RDAuthenticateLogin(const QString &username,const QString &passwd,
|
||||
|
||||
QString RDAuthenticateSession(long int session_id,const QHostAddress &addr)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
//
|
||||
// Expire Stale Sessions
|
||||
//
|
||||
QDateTime current_datetime=
|
||||
QDateTime(QDate::currentDate(),QTime::currentTime());
|
||||
QString sql=QString().sprintf("delete from WEB_CONNECTIONS \
|
||||
where TIME_STAMP<\"%s\"",
|
||||
(const char *)current_datetime.
|
||||
addSecs(-RD_WEB_SESSION_TIMEOUT).
|
||||
toString("yyyy-MM-dd hh:mm:ss"));
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
sql=QString("delete from WEB_CONNECTIONS where ")+
|
||||
"TIME_STAMP<\""+current_datetime.addSecs(-RD_WEB_SESSION_TIMEOUT).
|
||||
toString("yyyy-MM-dd hh:mm:ss")+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Check for Session
|
||||
//
|
||||
sql=QString().sprintf("select LOGIN_NAME,IP_ADDRESS from WEB_CONNECTIONS \
|
||||
where SESSION_ID=%ld",
|
||||
session_id);
|
||||
sql=QString("select LOGIN_NAME,IP_ADDRESS from WEB_CONNECTIONS where ")+
|
||||
QString().sprintf("SESSION_ID=%ld",session_id);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
@ -737,11 +735,9 @@ QString RDAuthenticateSession(long int session_id,const QHostAddress &addr)
|
||||
//
|
||||
// Update Session
|
||||
//
|
||||
sql=QString().sprintf("update WEB_CONNECTIONS set TIME_STAMP=\"%s\" \
|
||||
where SESSION_ID=%ld",
|
||||
(const char *)current_datetime.
|
||||
toString("yyyy-MM-dd hh:mm:dd"),
|
||||
session_id);
|
||||
sql=QString("update WEB_CONNECTIONS set ")+
|
||||
"TIME_STAMP=\""+current_datetime.toString("yyyy-MM-dd hh:mm:dd")+"\" "+
|
||||
QString().sprintf("where SESSION_ID=%ld",session_id);
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
|
@ -31,7 +31,7 @@ moc_%.cpp: %.h
|
||||
|
||||
install-exec-am:
|
||||
mkdir -p $(DESTDIR)/$(libexecdir)
|
||||
cp rdcastmanager.cgi $(DESTDIR)$(libexecdir)/
|
||||
cp .libs/rdcastmanager.cgi $(DESTDIR)$(libexecdir)/
|
||||
cat rdcastmanager.js | $(top_srcdir)/helpers/jsmin > $(DESTDIR)$(libexecdir)/rdcastmanager.js
|
||||
|
||||
uninstall:
|
||||
|
Loading…
x
Reference in New Issue
Block a user