* SUMMARY: using getprpwent(3) with C2?
@ 1998-06-22 5:05 Simon Greaves
0 siblings, 0 replies; only message in thread
From: Simon Greaves @ 1998-06-22 5:05 UTC (permalink / raw)
To: tru64-unix-managers
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="--------------5DD7398537A1D6C6C7D68A06", Size: 7214 bytes --]
This is a multi-part message in MIME format.
--------------5DD7398537A1D6C6C7D68A06
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
In essence, my original query was 'how do I get the getprpw* calls to
work?' and the answer is 'by reading the manual pages properly!'. I'm a
little embarrassed to say that though I did read the manual page several
times I somehow managed to miss the bit that says:
Programs must call set_auth_parameters() before any other action in
main().
Seems glaringly obvious now, must have been the thought of an nice cold
beer after all this sun... :-)
Thanks to:
Jon Morgan <jmorgan@dircon.co.UK>
MC.Vialatte@cust.univ-bpclermont.FR
Lucien_HERCAUD@paribas.COM
Jane Kramer <Jane.Kramer@oberlin.EDU>
Eric <Eric.Rostetter@utoledo.EDU>
Randy Rodgers <rrodgers@ci.ft-wayne.in.US>
Don Newcomer <newcomer@dickinson.EDU>
Steve VanDevender <stevev@hexadecimal.uoregon.EDU>
I'll append Jon's response as it sums up pretty well what everyone else
said.
Incidentally - in the interim I started coding up a program in perl,
capturing the output from 'edauth -g' instead of using getprpw*. This is
nicer in some respects because the names of the ttys are not truncated
as they are in the pr_field C structure.
> Hi Simon,
>
> You need to initialise the database first. This is quite simple
> and can be done as follows (code amended to include the
> initialisation command that you need to enter):
>
> #include <sys/types.h>
> #include <sys/security.h>
> #include <prot.h>
>
> void
> main(void)
> {
> struct pr_passwd *prPasswd;
>
> /* Initilise access to the database... */
>
> set_auth_parameters(argc, argv) ;
>
> /* Rewind the authorisation database... */
>
> setprpwent()
>
> /* try getting an entry by name.. */
> prPasswd = getprpwnam("greaves");
> }
>
> From the man page for setprpwent(3):
>
> Programs must call set_auth_parameters() before any other action
> in main().
>
> Hope this helps!
>
> -jon.
Simon
--
Simon Greaves voice: (+679) 212114
Computer Centre fax: (+679) 304089
The University of the South Pacific email: greaves_s@usp.ac.fj
Suva, Fiji
--------------5DD7398537A1D6C6C7D68A06
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-path: <>
Received: from UTCP-DAEMON by usp.ac.fj (PMDF V5.1-10 #7756)
id <01IYJ8D1CZXS8Y58ZQ@usp.ac.fj>; Mon, 22 Jun 1998 10:32:07 +1200
Received: from usp.ac.fj (PMDF V5.1-10 #7756)
id <01IYJ8CQEW1U8Y58ZO@usp.ac.fj>; Mon, 22 Jun 1998 10:32:05 +1200
Date: Mon, 22 Jun 1998 10:32:05 +1200
From: PMDF e-Mail Interconnect <postmaster@usp.ac.fj>
Subject: Delivery Notification: Delivery has failed
To: greaves_s@usp.ac.fj, postmaster@usp.ac.fj
Message-id: <01IYJ8CZZP948Y58ZO@usp.ac.fj>
MIME-version: 1.0
Content-type: MULTIPART/REPORT;
BOUNDARY="Boundary_(ID_kjM/f8pmjap/8eqXvITyBQ)"; REPORT-TYPE=DELIVERY-STATUS
--Boundary_(ID_kjM/f8pmjap/8eqXvITyBQ)
Content-type: text/plain
This report relates to a message you sent with the following header fields:
Message-id: <358D890A.D177F3D7@usp.ac.fj>
Date: Mon, 22 Jun 1998 10:28:26 +1200
From: Simon Greaves <greaves_s@usp.ac.fj>
To: alpha-osf-manager@ornl.GOV
Subject: SUMMARY: using getprpwent(3) with C2?
Your message cannot be delivered to the following recipients:
Recipient address: alpha-osf-manager@ornl.GOV
Reason: Remote SMTP server has rejected address
Diagnostic code: smtp; 550 5.1.1 unknown or illegal user: alpha-osf-manager@ornl.GOV
Remote system: dns; oaunx2.ctd.ornl.gov (TCP|144.120.8.4|2332|128.219.128.94|25) (oaunx2.ctd.ornl.gov -- Server ESMTP [PMDF V5.1-10 #23475]) (oaunx2.ctd.ornl.gov)
--Boundary_(ID_kjM/f8pmjap/8eqXvITyBQ)
Content-type: message/DELIVERY-STATUS
Original-envelope-id: 01IYJ8COTK0G8Y58MJ@usp.ac.fj
Reporting-MTA: dns; usp.ac.fj
Action: failed
Status: 5.0.0 (Remote SMTP server has rejected address)
Original-recipient: rfc822;alpha-osf-manager@ornl.gov
Final-recipient: rfc822;alpha-osf-manager@ornl.GOV
Remote-MTA: dns; oaunx2.ctd.ornl.gov (TCP|144.120.8.4|2332|128.219.128.94|25)
(oaunx2.ctd.ornl.gov -- Server ESMTP [PMDF V5.1-10 #23475])
(oaunx2.ctd.ornl.gov)
Diagnostic-code: smtp; 550 5.1.1 unknown or illegal user:
alpha-osf-manager@ornl.GOV
--Boundary_(ID_kjM/f8pmjap/8eqXvITyBQ)
Content-type: MESSAGE/RFC822
Return-path: greaves_s@usp.ac.fj
Received: from UTCP-DAEMON by usp.ac.fj (PMDF V5.1-10 #7756)
id <01IYJ8CQEW1U8Y58ZO@usp.ac.fj> (original mail from greaves_s@usp.ac.fj)
; Mon, 22 Jun 1998 10:32:05 +1200
Received: from teri.usp.ac.fj by usp.ac.fj (PMDF V5.1-10 #7756)
with SMTP id <01IYJ8COT0Q68Y58MJ@usp.ac.fj> for alpha-osf-manager@ornl.GOV;
Mon, 22 Jun 1998 10:31:50 +1200
Received: from pc0169.usp.ac.fj by teri.usp.ac.fj
(5.65v3.2/1.1.10.5/19Nov97-1014AM) id AA17704; Mon, 22 Jun 1998 10:28:27 +1200
Date: Mon, 22 Jun 1998 10:28:26 +1200
From: Simon Greaves <greaves_s@usp.ac.fj>
Subject: SUMMARY: using getprpwent(3) with C2?
Sender: greaves@teri.usp.ac.fj
To: alpha-osf-manager@ornl.GOV
Message-id: <358D890A.D177F3D7@usp.ac.fj>
Organization: The University of the South Pacific
MIME-version: 1.0
X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.32 i586)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit
In essence, my original query was 'how do I get the getprpw* calls to
work?' and the answer is 'by reading the manual pages properly!'. I'm a
little embarrassed to say that though I did read the manual page several
times I somehow managed to miss the bit that says:
Programs must call set_auth_parameters() before any other action in
main().
Seems glaringly obvious now, must have been the thought of an nice cold
beer after all this sun... :-)
Thanks to:
Jon Morgan <jmorgan@dircon.co.UK>
MC.Vialatte@cust.univ-bpclermont.FR
Lucien_HERCAUD@paribas.COM
Jane Kramer <Jane.Kramer@oberlin.EDU>
Eric <Eric.Rostetter@utoledo.EDU>
Randy Rodgers <rrodgers@ci.ft-wayne.in.US>
Don Newcomer <newcomer@dickinson.EDU>
Steve VanDevender <stevev@hexadecimal.uoregon.EDU>
I'll append Jon's response as it sums up pretty well what everyone else
said.
> Hi Simon,
>
> You need to initialise the database first. This is quite simple
> and can be done as follows (code amended to include the
> initialisation command that you need to enter):
>
> #include <sys/types.h>
> #include <sys/security.h>
> #include <prot.h>
>
> void
> main(void)
> {
> struct pr_passwd *prPasswd;
>
> /* Initilise access to the database... */
>
> set_auth_parameters(argc, argv) ;
>
> /* Rewind the authorisation database... */
>
> setprpwent()
>
> /* try getting an entry by name.. */
> prPasswd = getprpwnam("greaves");
> }
>
> From the man page for setprpwent(3):
>
> Programs must call set_auth_parameters() before any other action
> in main().
>
> Hope this helps!
>
> -jon.
Simon
--
Simon Greaves voice: (+679) 212114
Computer Centre fax: (+679) 304089
The University of the South Pacific email: greaves_s@usp.ac.fj
Suva, Fiji
--Boundary_(ID_kjM/f8pmjap/8eqXvITyBQ)--
--------------5DD7398537A1D6C6C7D68A06--
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1998-06-22 5:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-06-22 5:05 SUMMARY: using getprpwent(3) with C2? Simon Greaves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox