- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- compile problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 04:36 PM
01-30-2003 04:36 PM
compile problem
Here is C code that may be used to programmatically change a user's password on a trusted system.
/*
* When run as root and given a "username" as a first argument
* and "password" as a second argument, this program modifies
* that user's password entry with a new encrypted password.
* This is for a trusted system.
*
* Compile with "-lsec" option.
*
* Exit values are:
* 0 : Success
* 1 : Incorrect argument count
* 2 : Failure to getprpwnam(3) the password information
* 3 : Failure to putprpwnam(3) the password information
*/
#include
char get_salt_char() {
int random_number;
random_number = abs(time(0) * random(time(0)) * getpid()) % 65;
if (random_number < 26) return('a' + random_number);
if (random_number < 52) return('A' + random_number - 26);
if (random_number < 62) return('0' + random_number - 52);
if (random_number == 62) return('.');
if (random_number == 63) return('/');
if (random_number == 64) return(get_salt_char());
}
main(argc, argv) int argc; char *argv[]; {
char username[10];
char password[10];
char salt[2];
struct pr_passwd *prpwd_entry;
strcpy(username, argv[1]);
strcpy(password, argv[2]);
salt[0] = get_salt_char();
salt[1] = get_salt_char();
if (argc != 3) {
printf("Incorrect argument count: %d\n", argc-1);
printf ("Usage: %s username password \n", argv[0]); exit(1);
}
if ((prpwd_entry = getprpwnam(argv[1])) == NULL) {
printf("failed to get password information for '%s'\n", username);
printf ("Usage: %s username password \n", argv[0]); exit(2);
}
strcpy(prpwd_entry->ufld.fd_encrypt, crypt(password, salt));
if (putprpwnam(argv[1], prpwd_entry) == NULL) {
printf("failed to put password information for '%s'\n", username);
exit(3);
}
endprpwent();
return(0);
}
I am getting a "bad syntax for #include directive error. Please help. thanks MPW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 04:47 PM
01-30-2003 04:47 PM
Re: compile problem
Remember that in C the # is NOT a comment. Go back and check where you got the C program from and see if there is anything else for the include statement there.
Perhaps you could post the link you got the program from?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 04:54 PM
01-30-2003 04:54 PM
Re: compile problem
You need something like
#include
#include "./myfile.h"
Multiple include files are allowed; those within < > indicate look in the standard locations (e.g. /usr/include) while those with "filename" indicate a pathname.
There may be more errors but your first task is to identify any needed header files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 05:16 PM
01-30-2003 05:16 PM
Re: compile problem
http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062769744
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 05:29 PM
01-30-2003 05:29 PM
Re: compile problem
Try the following includes
#include
#include
#include
#include
#include
#include
#include
#include
#include
One or more may not be required but there is no harm. prot.h and crypt.h are definitely required.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 06:33 PM
01-30-2003 06:33 PM
Re: compile problem
I would follow Sridhar's advice and use the include statements he specifies.
I would also go down to the comments section in that document and explain the difficulties and the incorrect #include statements in the document.
In fact, I'm going to do that right now. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 06:53 PM
01-30-2003 06:53 PM
Re: compile problem
Did you say you were going to compile the program?
What else could be called dedication?
I bow to thee.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2003 07:25 PM
01-30-2003 07:25 PM
Re: compile problem
I meant that I was going to fill out the comments section, which I did, in the document link that was given and complain about the lack of properly formatted #include lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2003 05:11 AM
01-31-2003 05:11 AM
Re: compile problem
The code that the submitter references has just the #includes with no header file referenced.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2003 05:11 AM
01-31-2003 05:11 AM
Re: compile problem
The code that the submitter references has just the #includes with no header file referenced.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2003 06:28 AM
02-01-2003 06:28 AM
Re: compile problem
#include
you will need
#
other than that the problem seems pretty much nailed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:44 AM
02-04-2003 08:44 AM