mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
2017-04-06 Fred Gleason <fredg@paravelsystems.com>
* Added an rdauth(1) utility in 'utils/rdauth/'. * Fixed a regression in 'lib/rdcart.cpp' that caused the 'Import' web API call to fail with an 'unsupported format' error.
This commit is contained in:
@@ -28,6 +28,7 @@ if ALSA_RD_AM
|
||||
endif
|
||||
SUBDIRS = $(ALSACONFIG_RD_OPT)\
|
||||
$(HPIINFO_RD_OPT)\
|
||||
rdauth\
|
||||
rddbcheck\
|
||||
rddgimport\
|
||||
rdcheckcuts\
|
||||
|
49
utils/rdauth/Makefile.am
Normal file
49
utils/rdauth/Makefile.am
Normal file
@@ -0,0 +1,49 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/utils/rdauth
|
||||
##
|
||||
## (C) Copyright 2017 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License version 2 as
|
||||
## published by the Free Software Foundation.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public
|
||||
## License along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@ -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
# The dependency for qt's Meta Object Compiler (moc)
|
||||
moc_%.cpp: %.h
|
||||
$(MOC) $< -o $@
|
||||
|
||||
install-exec-hook:
|
||||
if test -z $(DESTDIR) ; then chown root $(DESTDIR)$(prefix)/bin/rdauth ; chmod 4755 $(DESTDIR)$(prefix)/bin/rdauth ; fi
|
||||
|
||||
bin_PROGRAMS = rdauth
|
||||
|
||||
dist_rdauth_SOURCES = rdauth.cpp rdauth.h
|
||||
|
||||
rdauth_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.idb\
|
||||
*ilk\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in\
|
||||
moc_*
|
63
utils/rdauth/rdauth.cpp
Normal file
63
utils/rdauth/rdauth.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
// rdauth.cpp
|
||||
//
|
||||
// Authenticate against a PAM service.
|
||||
//
|
||||
// (C) Copyright 2017 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <rdpam.h>
|
||||
|
||||
#include "rdauth.h"
|
||||
|
||||
MainObject::MainObject(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
//
|
||||
// Read Command Options
|
||||
//
|
||||
QString service_name;
|
||||
QString user;
|
||||
QString password="";
|
||||
RDCmdSwitch *cmd=
|
||||
new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdauth",RDAUTH_USAGE);
|
||||
if(cmd->keys()==3) {
|
||||
password=cmd->key(2);
|
||||
}
|
||||
else {
|
||||
if(cmd->keys()!=2) {
|
||||
fprintf(stderr,"rdauth: invalid arguments\n");
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
service_name=cmd->key(0);
|
||||
user=cmd->key(1);
|
||||
|
||||
RDPam *pam=new RDPam(service_name);
|
||||
if(pam->authenticate(user,password)) {
|
||||
exit(0);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new MainObject();
|
||||
return a.exec();
|
||||
}
|
42
utils/rdauth/rdauth.h
Normal file
42
utils/rdauth/rdauth.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// rdauth.h
|
||||
//
|
||||
// Authenticate against a PAM service.
|
||||
//
|
||||
// (C) Copyright 2017 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef RDAUTH_H
|
||||
#define RDAUTH_H
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qsqldatabase.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdcmd_switch.cpp>
|
||||
|
||||
#define RDAUTH_USAGE "\n"
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
public:
|
||||
MainObject(QObject *parent=0);
|
||||
};
|
||||
|
||||
|
||||
#endif // RDAUTH_H
|
Reference in New Issue
Block a user