Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Carreer:Networking Programming in Unix (C programming Language) Post 302232999 by ovais245 on Friday 5th of September 2008 07:05:26 PM
Old 09-05-2008
Write or study a small program that mimics the most common login procedures in UNIX.
You have two options here. Either, you write it yourself according to the specification
below, or you copy the file
/cab/cestud/work/edu/course/EDA263_Computer_Security/
lib/login_linux/login_linux.c into your home directory. If you choose to write
it yourself the following should be implemented.
- The program begins with displaying ”login:” and takes the username as input.
7
- Then the program writes ”Password:” and waits for the password to be entered,
which should not be visible on the terminal (use the function getpass(3) that
among other things will see to that the text is not ”echoed” on the terminal).
- The program queries the system’s user database to see if the username exists. If
this is the case it encrypts the entered password (with a known algorithm) and
ensures it corresponds to the stored encrypted password belonging to the actual
user. Suitable library routines are getpwnam(3), crypt(3) and strncmp(3).
- If the username does not exist, or if the password is wrong, the program displays
”Login incorrect” and restarts from the beginning, otherwise it writes something
like ”Welcome to this System!” and terminates.
Test that your program works by compiling and running it.
This User Gave Thanks to ovais245 For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Does the programming language matters?

I see you guys encouraged people studied and used C while they were working on UNIX. Does C++ or JAVA matter? And in the past threads, Neo, PxT, and other members recommanded lots good books. I think those people who asked for the references, such as Dominic, had experiences on sys admin or... (8 Replies)
Discussion started by: HOUSCOUS
8 Replies

2. Programming

c programming language

Can someone enligten me on what below program does? I understand getchar and putchar.. but what is this program suppose to do? I try to put printf on it, but it shows nothing.. can someone explain to me what this program is suppose to do? It is reading something and assigning to c? so, if... (8 Replies)
Discussion started by: convenientstore
8 Replies

3. UNIX for Dummies Questions & Answers

Is PERL a programming language?

I need a small and simple clarification... Can someone tell me whether PERL is a programming language or not. Also, can shell scripts also considered as programming language or not. Also, please tell me the exact difference between programming language and scripting. Please help.... (3 Replies)
Discussion started by: Anjan1
3 Replies

4. Programming

What Programming language should I start learning first?

I want to create a computer program that will translate from English to Spanish and vice versa. So someone could type in a word, phrase, or paragraph and translate from one language to another. What programming language would I use to write up the code and then implement this program? I want to... (8 Replies)
Discussion started by: Anna Hussie
8 Replies

5. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

6. Programming

Whats the most in-demand programming language UNIX

I am interested in learning Programming Language to complement my UNIX. What language should I concentrate on to enhance my UNIX. What companies are seeking with UNIX. What languages are used with UNIX as for as there application. Are there any one here from DC (6 Replies)
Discussion started by: zbest1966
6 Replies
C(7)						       BSD Miscellaneous Information Manual						      C(7)

NAME
c, c78, c89, c90, c99 -- The C programming language DESCRIPTION
C is a general purpose programming language, which has a strong connection with the UNIX operating system and its derivatives, since the vast majority of those systems were written in the C language. The C language contains some basic ideas from the BCPL language through the B lan- guage written by Ken Thompson in 1970 for the DEC PDP-7 machines. The development of the UNIX operating system was started on a PDP-7 machine in assembly language, but this choice made it very difficult to port the existing code to other systems. In 1972 Dennis M. Ritchie worked out the C programming language for further development of the UNIX operating system. The idea was to imple- ment only the C compiler for different platforms, and implement most parts of the operating system in the new programming language to sim- plify the portability between different architectures. It follows that C is very well adapted for (but not limited to) writing operating systems and low-level applications. The C language did not have a specification or standardized version for a long time. It went through a lot of changes and improvements for ages. In 1978, Brian W. Kernighan and Dennis M. Ritchie published the first book about C under the title ``The C Programming Language''. We can think of this book as the first specification of the language. This version is often referred to as ``K&R C'' after the names of the authors. Sometimes it is referred to as C78, as well, after the publishing year of the first edition of the book. It is important to notice that the instruction set of the language is limited to the most fundamental elements for simplicity. Handling of the standard I/O and similar common functions are implemented in the libraries shipped with the compiler. As these functions are also widely used, it was demanded to include into the description what requisites the library should conform to, not just strictly the language itself. Accordingly, the aforementioned standards cover the library elements, as well. The elements of this standard library are still not enough for more complicated tasks. In this case the provided system calls of the given operating system can be used. To not lose the portability by using these system calls, the POSIX (Portable Operating System Interface (for Unix)) standard evolved. It describes what functions should be available to keep portability. Note, that POSIX is not a C standard, but an operating system standard and thus is beyond the scope of this manual. The standards discussed below are all C standards and only cover the C programming language and the accompanying library. After the publication of the book mentioned before, the American National Standards Institute (ANSI) started to work on standardizing the language, and in 1989 they announced ANSI X3.159-1989. It is usually referred to as ANSI C or C89. The main difference in this standard were the function prototypes, which was a new way of declaring functions. With the old-style function declarations, the compiler was unable to check the sanity of the actual parameters of a function call. The old syntax was highly error-prone because incompatible parameters were hard to detect in the program code and the problem only showed up at run-time. In 1990, the International Organization for Standardization (ISO) adopted the ANSI standard as ISO/IEC 9899:1990. This is also referred to as ISO C or C90. It only contains negligible minor modifications against ANSI C, so the two standards are often considered to be fully equivalent. This was a very important milestone in the history of the C language, but the development of the language did not stop. The ISO C standard was later extended with an amendment as ISO/IEC 9899 AM1 in 1995. This contained, for example, the wide-character support in wchar.h and wctype.h. Two corrigenda were also published: Technical Corrigendum 1 as ISO/IEC 9899 TCOR1 in 1995 and Technical Corrigendum 2 as ISO/IEC 9899 TCOR2 in 1996. The continuous development and growth made it necessary to work out a new standard, which contains the new features and fixes the known defects and deficiencies of the language. As a result, ISO/IEC 9899:1999 was born in 1999. Similarly to the other standards, this is referred to after the publication year as C99. The improvements include the following: o Inline functions. o Support for variable length arrays. o New high-precision integer type named long long int, and other integer types described in stdint(3) and inttypes(3). o New boolean data type; see stdbool(3). o One line comments taken from the C++ language. o Some new preprocessor features. o A predefined identifier __func__ and a restrict type qualifier. o New variables can be declared anywhere, not just in the beginning of the program or program blocks. o No implicit int type. Since then no new standards have been published, but the C language is still evolving. New and useful features have been showing up in the most famous C compiler: GNU C (gcc(1)). Most of the UNIX-like operating systems use GNU C as a system compiler, but the various extensions of GNU C, such as attribute(3) or typeof(3), should not be considered standard features. SEE ALSO
c89(1), c99(1), cc(1), cdefs(3) Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Prentice Hall, Second Edition, 40th printing, 1988. STANDARDS
ANSI, X3.159-1989. ISO/IEC, 9899:1990, Programming languages -- C. ISO/IEC, 9899 AM1. ISO/IEC, 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1. ISO/IEC, 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2. ISO/IEC, 9899:1999, Programming languages -- C. ISO/IEC, 9899:1999 TCOR1, Programming languages -- C, Technical Corrigendum 1. ISO/IEC, 9899:1999 TCOR2, Programming languages -- C, Technical Corrigendum 2. ISO/IEC, 9899:1999 TCOR3, Programming languages -- C, Technical Corrigendum 3. HISTORY
This manual page first appeared in FreeBSD 9.0 and NetBSD 6.0. AUTHORS
This manual page was written by Gabor Kovesdan <gabor@FreeBSD.org>. BSD
March 30, 2011 BSD
All times are GMT -4. The time now is 08:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy