Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
a2f8db92
Commit
a2f8db92
authored
Jun 24, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Login command and show user command added
parent
2cb411b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
4 deletions
+99
-4
src/lib/rt/src/rt_rtt_command.c
src/lib/rt/src/rt_rtt_command.c
+99
-4
No files found.
src/lib/rt/src/rt_rtt_command.c
View file @
a2f8db92
/*
/*
* Proview $Id: rt_rtt_command.c,v 1.1
0 2007-04-25 13:39:21
claes Exp $
* Proview $Id: rt_rtt_command.c,v 1.1
1 2008-06-24 07:16:19
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -57,10 +57,12 @@
...
@@ -57,10 +57,12 @@
#include "pwr.h"
#include "pwr.h"
#include "pwr_class.h"
#include "pwr_class.h"
#include "pwr_privilege.h"
#include "pwr_baseclasses.h"
#include "pwr_baseclasses.h"
#include "co_time.h"
#include "co_time.h"
#include "co_cdh.h"
#include "co_cdh.h"
#include "co_ccm.h"
#include "co_ccm.h"
#include "co_api_user.h"
#include "rt_gdh.h"
#include "rt_gdh.h"
#include "rt_ini_alias.h"
#include "rt_ini_alias.h"
#include "rt_rtt.h"
#include "rt_rtt.h"
...
@@ -151,6 +153,8 @@ static int exit_func( menu_ctx ctx,
...
@@ -151,6 +153,8 @@ static int exit_func( menu_ctx ctx,
int
*
flag
);
int
*
flag
);
static
int
classhier_func
(
menu_ctx
ctx
,
static
int
classhier_func
(
menu_ctx
ctx
,
int
*
flag
);
int
*
flag
);
static
int
rtt_login_func
(
menu_ctx
ctx
,
int
*
flag
);
static
int
rtt_show_object_add
(
static
int
rtt_show_object_add
(
pwr_tObjid
objid
,
pwr_tObjid
objid
,
rtt_t_menu
**
menulist
,
rtt_t_menu
**
menulist
,
...
@@ -1367,6 +1371,30 @@ static int show_func( menu_ctx ctx,
...
@@ -1367,6 +1371,30 @@ static int show_func( menu_ctx ctx,
sts
=
rtt_set_do_testvalue
(
objid
,
on
,
1
);
sts
=
rtt_set_do_testvalue
(
objid
,
on
,
1
);
return
sts
;
return
sts
;
}
}
else
if
(
strncmp
(
arg1_str
,
"USER"
,
strlen
(
arg1_str
))
==
0
)
{
char
msg
[
200
];
sprintf
(
msg
,
"User: %s "
,
rtt_user
);
switch
(
rtt_priv
)
{
case
RTT_PRV_SYS
:
strcat
(
msg
,
"(System)"
);
break
;
case
RTT_PRV_PROC
:
strcat
(
msg
,
"(Process)"
);
break
;
case
RTT_PRV_EL
:
strcat
(
msg
,
"(Maintenance)"
);
break
;
case
RTT_PRV_OP
:
strcat
(
msg
,
"(Operator)"
);
break
;
default:
strcat
(
msg
,
"(-)"
);
break
;
}
rtt_message
(
'I'
,
msg
);
return
RTT__NOPICTURE
;
}
else
else
{
{
/* This might be a system picture */
/* This might be a system picture */
...
@@ -4183,7 +4211,7 @@ static int rtt_delete_func( menu_ctx ctx,
...
@@ -4183,7 +4211,7 @@ static int rtt_delete_func( menu_ctx ctx,
/*************************************************************************
/*************************************************************************
*
*
* Name: rtt_
delete
_func()
* Name: rtt_
view
_func()
*
*
* Type int
* Type int
*
*
...
@@ -4570,6 +4598,68 @@ static int classhier_func( menu_ctx ctx,
...
@@ -4570,6 +4598,68 @@ static int classhier_func( menu_ctx ctx,
return
sts
;
return
sts
;
}
}
/*************************************************************************
*
* Name: rtt_login_func()
*
* Type int
*
* Type Parameter IOGF Description
* menu_ctx ctx I rtt context.
*
* Description:
* This function is called when a "login" command i recieved.
*
**************************************************************************/
static
int
rtt_login_func
(
menu_ctx
ctx
,
int
*
flag
)
{
int
sts
;
char
username_str
[
80
];
char
password_str
[
80
];
char
systemgroup
[
80
];
unsigned
int
privilege
;
if
(
ODD
(
rtt_get_qualifier
(
"rtt_arg1"
,
username_str
))
&&
ODD
(
rtt_get_qualifier
(
"rtt_arg2"
,
password_str
)))
{
sts
=
gdh_GetObjectInfo
(
"pwrNode-System.SystemGroup"
,
&
systemgroup
,
sizeof
(
systemgroup
));
if
(
EVEN
(
sts
))
return
sts
;
cdh_ToLower
(
password_str
,
password_str
);
sts
=
user_CheckUser
(
systemgroup
,
username_str
,
user_PwCrypt
(
password_str
),
&
privilege
);
if
(
EVEN
(
sts
))
{
rtt_message
(
'E'
,
"User not authorized"
);
return
RTT__SUCCESS
;
}
if
(
privilege
&
pwr_mPrv_System
)
rtt_priv
=
RTT_PRV_SYS
;
else
if
(
privilege
&
pwr_mPrv_Maintenance
)
rtt_priv
=
RTT_PRV_EL
;
else
if
(
privilege
&
pwr_mPrv_Process
||
privilege
&
pwr_mPrv_Instrument
)
rtt_priv
=
RTT_PRV_PROC
;
else
if
(
privilege
|
pwr_mAccess_AllRt
)
rtt_priv
=
RTT_PRV_OP
;
else
{
rtt_message
(
'E'
,
"User not authorized"
);
return
RTT__SUCCESS
;
}
strncpy
(
rtt_user
,
username_str
,
sizeof
(
rtt_user
));
return
RTT__SUCCESS
;
}
else
{
sts
=
rtt_logon_pict
(
rtt_chn
,
&
rtt_priv
);
if
(
EVEN
(
sts
))
rtt_message
(
'E'
,
"Not authorized"
);
return
RTT__SUCCESS
;
}
return
RTT__SUCCESS
;
}
/*************************************************************************
/*************************************************************************
*
*
...
@@ -4743,12 +4833,17 @@ rtt_t_comtbl rtt_command_table[] = {
...
@@ -4743,12 +4833,17 @@ rtt_t_comtbl rtt_command_table[] = {
{
{
"DELETE"
,
"DELETE"
,
&
rtt_delete_func
,
&
rtt_delete_func
,
{
"rtt_arg1"
,
"/NAME"
}
{
"rtt_arg1"
,
"/NAME"
,
""
}
},
},
{
{
"VIEW"
,
"VIEW"
,
&
rtt_view_func
,
&
rtt_view_func
,
{
"rtt_arg1"
,
"/FILE"
}
{
"rtt_arg1"
,
"/FILE"
,
""
}
},
{
"LOGIN"
,
&
rtt_login_func
,
{
"rtt_arg1"
,
"rtt_arg2"
,
""
}
},
},
{
""
,}};
{
""
,}};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment