Commit ac7d42f7 authored by claes's avatar claes

Obsolete

parent 00e629ba
$!
$! PROVIEW/R
$!
$! Filename: dlogin_src:ds_login.link
$!
$! Description: This command procedure link ds_login
$!
$ set noon
$ file = "ds_login"
$ source = "pwr_kit:''file'.opt"
$ target = "pwr_exe:''file'.exe"
$ linkflags = "/nodebug/notraceback"
$ if f$trnlnm("pwrd_''file'_build") .nes. ""
$ then
$ map = ""
$ else
$ map = "/map=pwr_lis:''file'.map/full"
$ endif
$
$ write sys$output "link ''f$search(source)' ''linkflags'"
$
$ link 'linkflags' /exe='target' 'source'/opt 'map'
$ if f$search(target) .nes. "" then purge/noconfirm/nolog 'target'
$ if f$search("pwr_lis:''file'.map") .nes. "" then purge/noconfirm/nolog pwr_lis:'file'.map
$ dbgset 'target' 0
$!
$ exit
/*
* Proview $Id: cli.c,v 1.2 2005-09-01 14:57:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <clidef.h>
#include <climsgdef.h>
#include <ssdef.h>
#include <descrip.h>
#include <lib$routines.h>
#include "wb_foe_macros.h"
#include <Xm/Xm.h>
#include <processes.h>
#include <smgdef.h>
#include <trmdef.h>
#include "pwr.h"
#include "pwr_class.h"
#include "wb_login_msg.h"
#include "wb_foe_show.h"
#include "wb_login.h"
static login_t_userptr userlist = NULL;
pwr_tStatus login_cli_help ( )
{
char command[120] ;
strcpy ( command , "help/libra=pwr_lib:wb_foe pwr_au" ) ;
system ( command );
return LOGIN__SUCCESS;
}
void login_cli_quit ()
{
/* Quit */
login_db_close_userlist( userlist);
exit( LOGIN__SUCCESS);
}
void login_cli_exit ()
{
pwr_tStatus sts;
/* Save the session and quit */
sts = login_db_save_userlist( userlist);
login_db_close_userlist( userlist);
exit( sts);
}
pwr_tStatus login_cli_save ()
{
pwr_tStatus sts;
sts = login_db_save_userlist( userlist);
if (EVEN(sts))
printf( "Unable to open file");
return LOGIN__SUCCESS;
}
pwr_tStatus login_cli_add ()
{
char usernamestr[80] ;
char systemgroupstr[80] ;
char passwordstr[80] ;
char privstr[80] ;
char *usernamestr_p;
char *systemgroupstr_p;
char *passwordstr_p;
char *privstr_p;
unsigned long priv;
pwr_tStatus sts ;
int nr;
unsigned long priv_add;
unsigned long priv_remove;
pwr_tStatus condval;
priv_add = 0;
priv_remove = 0;
if ( foe_get_qual ( "allpwr" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mAccess_AllPwr;
else
priv_add |= pwr_mAccess_AllPwr;
}
if ( foe_get_qual ( "rtread" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_RtRead;
else
priv_add |= pwr_mPrv_RtRead;
}
if ( foe_get_qual ( "rtwrite" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_RtWrite;
else
priv_add |= pwr_mPrv_RtWrite;
}
if ( foe_get_qual ( "devread" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevRead;
else
priv_add |= pwr_mPrv_DevRead;
}
if ( foe_get_qual ( "devplc" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevPlc;
else
priv_add |= pwr_mPrv_DevPlc;
}
if ( foe_get_qual ( "devconfig" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevConfig;
else
priv_add |= pwr_mPrv_DevConfig;
}
if ( foe_get_qual ( "devclass" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevClass;
else
priv_add |= pwr_mPrv_DevClass;
}
if ( foe_get_qualval ( "username" , usernamestr, 80))
usernamestr_p = usernamestr;
else
usernamestr_p = NULL;
if ( foe_get_qualval ( "systemgroup" , systemgroupstr, 80))
systemgroupstr_p = systemgroupstr;
else
systemgroupstr_p = NULL;
if ( foe_get_qualval ( "password" , passwordstr, 80))
passwordstr_p = passwordstr;
else
passwordstr_p = NULL;
if ( foe_get_qualval ( "maskpriv" , privstr, 80))
{
/* Convert to int */
nr = sscanf( privstr, "%d", &priv);
if ( nr != 1)
{
printf("Priv sytax error\n");
return LOGIN__SUCCESS;
}
}
else
priv = 0;
sts = login_db_open_userlist( &userlist);
sts = login_db_user_add( &userlist, usernamestr_p, systemgroupstr_p,
passwordstr_p, priv, priv_add, priv_remove);
if ( EVEN(sts))
printf("User already exists\n");
return LOGIN__SUCCESS;
}
pwr_tStatus login_cli_modify ()
{
char usernamestr[80] ;
char systemgroupstr[80] ;
char passwordstr[80] ;
char privstr[80] ;
char *usernamestr_p;
char *systemgroupstr_p;
char *passwordstr_p;
unsigned long *priv_p;
unsigned long priv;
pwr_tStatus sts ;
int nr;
unsigned long priv_add;
unsigned long priv_remove;
pwr_tStatus condval;
priv_add = 0;
priv_remove = 0;
if ( foe_get_qual ( "allpwr" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mAccess_AllPwr;
else
priv_add |= pwr_mAccess_AllPwr;
}
if ( foe_get_qual ( "rtread" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_RtRead;
else
priv_add |= pwr_mPrv_RtRead;
}
if ( foe_get_qual ( "rtwrite" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_RtWrite;
else
priv_add |= pwr_mPrv_RtWrite;
}
if ( foe_get_qual ( "devread" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevRead;
else
priv_add |= pwr_mPrv_DevRead;
}
if ( foe_get_qual ( "devplc" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevPlc;
else
priv_add |= pwr_mPrv_DevPlc;
}
if ( foe_get_qual ( "devconfig" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevConfig;
else
priv_add |= pwr_mPrv_DevConfig;
}
if ( foe_get_qual ( "devclass" , &condval ))
{
if (condval == CLI$_NEGATED)
priv_remove |= pwr_mPrv_DevClass;
else
priv_add |= pwr_mPrv_DevClass;
}
if ( foe_get_qualval ( "username" , usernamestr, 80))
usernamestr_p = usernamestr;
else
usernamestr_p = NULL;
if ( foe_get_qualval ( "systemgroup" , systemgroupstr, 80))
systemgroupstr_p = systemgroupstr;
else
systemgroupstr_p = NULL;
if ( foe_get_qualval ( "password" , passwordstr, 80))
passwordstr_p = passwordstr;
else
passwordstr_p = NULL;
if ( foe_get_qualval ( "maskpriv" , privstr, 80))
{
/* Convert to int */
nr = sscanf( privstr, "%d", &priv);
if ( nr != 1)
{
printf("Priv sytax error\n");
return LOGIN__SUCCESS;
}
priv_p = &priv;
}
else
priv_p = NULL;
sts = login_db_open_userlist( &userlist);
sts = login_db_user_mod( userlist, usernamestr_p, systemgroupstr_p,
passwordstr_p, priv_p, priv_add, priv_remove);
if ( EVEN(sts))
printf("User not found\n");
return LOGIN__SUCCESS;
}
pwr_tStatus login_cli_remove()
{
char usernamestr[80] ;
char systemgroupstr[80] ;
char *usernamestr_p;
char *systemgroupstr_p;
pwr_tStatus sts ;
if ( foe_get_qualval ( "username" , usernamestr, 80))
usernamestr_p = usernamestr;
else
usernamestr_p = NULL;
if ( foe_get_qualval ( "systemgroup" , systemgroupstr, 80))
systemgroupstr_p = systemgroupstr;
else
systemgroupstr_p = NULL;
sts = login_db_open_userlist( &userlist);
sts = login_user_db_remove( userlist, usernamestr_p, systemgroupstr_p);
if ( EVEN(sts))
printf("User not found\n");
return LOGIN__SUCCESS;
}
pwr_tStatus login_cli_show ()
{
char usernamestr[80] ;
char systemgroupstr[80] ;
char passwordstr[80] ;
char privstr[80] ;
char *usernamestr_p;
char *systemgroupstr_p;
char *passwordstr_p;
char *privstr_p;
unsigned long priv;
pwr_tStatus sts ;
int nr;
pwr_tStatus condval;
int showpassword;
showpassword = foe_get_qual ( "__password" , &condval );
if ( foe_get_qual ( "all" , &condval ))
{
sts = login_db_open_userlist( &userlist);
sts = login_db_show_userlist( userlist, showpassword);
return sts;
}
else
{
if ( foe_get_qualval ( "username" , usernamestr, 80))
usernamestr_p = usernamestr;
else
usernamestr_p = NULL;
if ( foe_get_qualval ( "systemgroup" , systemgroupstr, 80))
systemgroupstr_p = systemgroupstr;
else
systemgroupstr_p = NULL;
sts = login_db_open_userlist( &userlist);
sts = login_db_show_user( userlist, usernamestr_p, systemgroupstr_p,
showpassword);
return sts;
}
}
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
! pwr_authorize.opt -- <short description>
!
! PROVIEW/R
! Copyright (C) 1996 by Comator Process AB.
!
! <Description>.
!
pwr_obj:pwr_authorize.obj
pwr_obj:pwr_authorize_cld.obj
pwr_obj:cli.obj
pwr_lib:libpwr_wb/lib
pwr_lib:libpwr_rt/lib
pwr_lib:libpwr_co/lib
pwr_lib:libpwr_ge/lib
pwr_lib:libpwr_flow/lib
pwr_lib:libpwr_glow/lib
sys$share:decw$xlibshr/share
sys$share:decw$xtlibshrr5/share
sys$share:decw$xmlibshr12/share
sys$share:decw$mrmlibshr12/share
sys$share:decw$dxmlibshr12/share
sys$share:dgit$libshr12/share
sql$user/lib
pwr_lib:co_lib/lib
pwr_obj:pwr_msg_co.obj
pwr_obj:pwr_msg_rt.obj
pwr_obj:pwr_msg_wb.obj
sys$share:!AS<tcpip>$rpcxdr_shr.exe/share
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
! pwr_authorize.opt -- <short description>
!
! PROVIEW/R
! Copyright (C) 1996 by Comator Process AB.
!
! <Description>.
!
pwr_obj:pwr_authorize.obj
pwr_obj:pwr_authorize_cld.obj
pwr_obj:cli.obj
pwr_lib:libpwr_wb/lib
pwr_lib:libpwr_rt/lib
pwr_lib:libpwr_co/lib
pwr_lib:libpwr_ge/lib
pwr_lib:libpwr_flow/lib
pwr_lib:libpwr_glow/lib
sys$share:decw$xlibshr/share
sys$share:decw$xtlibshrr5/share
sys$share:decw$xmlibshr12/share
sys$share:decw$mrmlibshr12/share
sys$share:decw$dxmlibshr12/share
sys$share:dgit$libshr12/share
sql$user/lib
pwr_lib:co_lib/lib
pwr_obj:pwr_msg_co.obj
pwr_obj:pwr_msg_rt.obj
pwr_obj:pwr_msg_wb.obj
sys$share:!AS<tcpip>$rpcxdr_shr.exe/share
/*
* Proview $Id: pwr_authorize.c,v 1.2 2005-09-01 14:57:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <string.h>
#include <clidef.h>
#include <climsgdef.h>
#include <ssdef.h>
#include <descrip.h>
#include <lib$routines.h>
#include <processes.h>
#include <smgdef.h>
#include <trmdef.h>
#include "pwr.h"
#include "pwr_class.h"
#include "wb_foe_msg.h"
#include "wb_vldh_msg.h"
#include "wb_foe.h"
int *pwr_authorize_cld(); /* module name in pwr_authorize_cld.cld */
extern pwr_tStatus smg$create_virtual_keyboard();
extern pwr_tStatus smg$read_composed_line();
extern pwr_tStatus cli$dcl_parse();
extern pwr_tStatus cli$dispatch();
main(int argc, char *argv[])
{
pwr_tStatus sts ;
int i;
static char str[256] ;
int key_id ;
$DESCRIPTOR ( device_desc , "sys$input" );
$DESCRIPTOR ( outdevice_desc , "sys$output" );
$DESCRIPTOR ( str_desc , str );
$DESCRIPTOR ( prompt_desc , "pwr_au> " );
unsigned short res_len ;
/* avanti */
/* init input */
sts = smg$create_virtual_keyboard (
&key_id ,
&device_desc ,
0 ,0, 0 );
while ( 1 )
{
/* get and parse the command */
/* get input */
sts = smg$read_composed_line (
&key_id , 0, &str_desc , &prompt_desc , &res_len);
if ( res_len == 0)
continue;
if ( !(sts && 1 ) ) lib$signal (sts ) ;
str[res_len] = 0 ;
sts = cli$dcl_parse (
&str_desc , pwr_authorize_cld, 0, 0 , 0 ) ;
/* send the command to the rtn associated */
if ( sts == CLI$_NORMAL )
{
sts = cli$dispatch ( ) ;
info_msg( sts);
}
}
}
! pwr_authorize.cld -- <short description>
!
! PROVIEW/R
! Copyright (C) 1996 by Comator Process AB.
!
! <Description>. */
!
module pwr_authorize_cld
! to get help
define verb help , routine login_cli_help
! to stop the game
define verb exit , routine login_cli_exit
define verb quit , routine login_cli_quit
! to save
define verb save , routine login_cli_save
! to modify
define verb modify , routine login_cli_modify
qualifier username , nonnegatable , value ( required )
qualifier systemgroup , nonnegatable , value ( required )
qualifier maskpriv , nonnegatable , value ( required )
qualifier password , nonnegatable , value ( required )
qualifier allpwr
qualifier rtread
qualifier rtwrite
qualifier devread
qualifier devplc
qualifier devconfig
qualifier devclass
disallow not username
disallow not systemgroup
! to add
define verb add , routine login_cli_add
qualifier username , nonnegatable , value ( required )
qualifier systemgroup , nonnegatable , value ( required )
qualifier maskpriv , nonnegatable , value ( required )
qualifier password , nonnegatable , value ( required )
qualifier allpwr
qualifier rtread
qualifier rtwrite
qualifier devread
qualifier devplc
qualifier devconfig
qualifier devclass
disallow not username
disallow not systemgroup
! to remove
define verb remove , routine login_cli_remove
qualifier username , nonnegatable , value ( required )
qualifier systemgroup , nonnegatable , value ( required )
disallow not username
disallow not systemgroup
! to show
define verb show , routine login_cli_show
qualifier username , nonnegatable , value ( required )
qualifier systemgroup , nonnegatable , value ( required )
qualifier all
qualifier __password
qualifier __passwor
disallow username and not systemgroup
disallow systemgroup and not username
disallow all and username
disallow all and systemgroup
disallow not username and not systemgroup and not all
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
! pwr_batch.opt -- <short description>
!
! PROVIEW/R
! Copyright (C) 1996 by Comator Process AB.
!
! <Description>.
!
pwr_obj:pwr_batch.obj
pwr_lib:libpwr_co/lib
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
! pwr_batch.opt -- <short description>
!
! PROVIEW/R
! Copyright (C) 1996 by Comator Process AB.
!
! <Description>.
!
pwr_obj:pwr_batch.obj
pwr_lib:libpwr_co/lib
/*
* Proview $Id: pwr_batch.c,v 1.2 2005-09-01 14:57:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdio.h>
#include <rms.h>
#include <string.h>
#include <stdlib.h>
#include <starlet.h>
#include <jbcmsgdef.h>
#include "pwr.h"
#include "co_time.h"
#include "co_utl_batch.h"
#define cProgName "cs_utl_batch_dispatcher"
#define cLogStart "-- PwrBatchStartLog"
#define cLogEnd "-- PwrBatchEndLog"
static int
ParseFilename (
char *InFilename,
char *OutFilename
);
static void
PrintLogFile (
char *LogFile
);
main (
int argc,
char *argv[]
) {
int sts;
char *Par[9];
char *Queue;
char *File;
int entry;
int i = 0;
int j = 0;
pwr_tTime time;
int number;
char Logfile[256];
char DeleCommand[256];
int Entry;
if (argc < 3) {
printf("%s, to few arguments!", cProgName);
exit(0);
}
Queue = argv[1];
File = argv[2];
for (j=0, i=3; argv[i] != NULL && j <= 8; i++, j++) {
Par[j] = argv[i];
}
Par[j] = NULL;
clock_gettime(CLOCK_REALTIME, &time);
srand(time.tv_sec);
number = rand();
sprintf(Logfile, "pwrp_tmp:%s_%010.10d.log", Queue, number);
sts = ParseFilename(Logfile, Logfile);
sprintf(DeleCommand, "$ delete/nolog/noconf %s*", Logfile);
sts = utl_BatchFindQueue(Queue);
if (!(sts & 1)) exit(sts);
sts = utl_BatchEnterJob(&Entry, Queue, File, Logfile, Par);
if (!(sts & 1)) exit(sts);
utl_BatchWaitJob(&Entry);
PrintLogFile(Logfile);
system(DeleCommand);
exit(sts);
}
static void
PrintLogFile (
char *LogFile
) {
FILE *lf;
char Line[1024];
char *s;
int log;
int len;
int lc;
int startlen = strlen(cLogStart);
int endlen = strlen(cLogEnd);
lf = fopen(LogFile, "r");
if (lf == NULL) {
printf("!! Could not read logfile: %s", LogFile);
perror(LogFile);
return;
}
for (log = 0, lc = 0;;) {
s = fgets(Line, sizeof(Line), lf);
if (s == NULL)
break;
if (!log) {
if (!strncmp(Line, cLogStart, startlen)) log = 1;
} else if (!strncmp(Line, cLogEnd, endlen)) {
break;
} else {
len = strlen(Line);
Line[len - 1] = '\0';
puts(Line);
lc++;
}
}
fclose(lf);
if (lc == 0) {
lf = fopen(LogFile, "r");
if (lf == NULL) {
printf("!! Could not read logfile: %s", LogFile);
perror(LogFile);
return;
}
for (;;) {
s = fgets(Line, sizeof(Line), lf);
if (s == NULL)
break;
len = strlen(Line);
Line[len - 1] = '\0';
puts(Line);
}
fclose(lf);
}
return;
}
static int
ParseFilename (
char *InFilename,
char *OutFilename
)
{
int sts;
struct NAM nam;
struct FAB fab;
char filename[NAM$C_MAXRSS];
fab = cc$rms_fab;
nam = cc$rms_nam;
fab.fab$l_fna = InFilename;
fab.fab$b_fns = strlen(InFilename);
fab.fab$l_nam = &nam;
nam.nam$l_esa = (char *) &filename;
nam.nam$b_ess = sizeof(filename);
nam.nam$v_noconceal = 1;
sts = sys$parse(&fab, 0, 0);
if (!(sts & 1)) return sts;
memcpy(OutFilename, filename, nam.nam$b_esl);
OutFilename[nam.nam$b_esl] = '\0';
return sts;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment