Unison Help

- Unison Kernel
- Pthreads
- pthread_create()
- pthread_exit()
- pthread_self()
- pthread_equal()
- pthread_join()
- pthread_detach()
- pthread_setschedparam()
- pthread_getschedparam()
- pthread_attr_init()
- pthread_attr_destroy()
- pthread_attr_setstackaddr()
- pthread_attr_getstackaddr()
- pthread_attr_setstacksize()
- pthread_attr_getstacksize()
- pthread_attr_setschedparam()
- pthread_attr_getschedparam()
- pthread_attr_setdetachstate()
- pthread_attr_getdetachstate()
- pthread_stackinfo()
- pthread_setprio()
- pthread_getprio()
- sched_get_priority_max()
- sched_get_priority_min()
- sched_yield()
- Pthread Cancellation
- Mutex
- Semaphores
- Message Queues
- Conditional Variables
- Barriers
- Timers
- Clocks
- Memory Allocation
- Rendezvous
- Interrupts
- Directory Services
- Miscellaneous
- Pthreads
- Unison I/O Library
- Unison STDIO Library
- STDIO Library Calls
- clearerr()
- dprintf()
- fclose()
- fdopen()
- feof()
- ferror()
- fileno()
- fflush()
- fgetc()
- fgetpos()
- fgets()
- fopen()
- fprintf()
- fputc()
- fputs()
- fread()
- freopen()
- fscanf()
- fseek()
- fseeko()
- fsetpos()
- ftell()
- ftello()
- fwrite()
- getc()
- getc_unlocked()
- getchar()
- getchar_unlocked()
- getdelim()
- getline()
- gets()
- get_stderr_ptr()
- get_stdin_ptr()
- get_stdout_ptr()
- noperprintf()
- perprintf()
- perror()
- posix_compat()
- printf()
- putc()
- putc_unlocked()
- putchar()
- putchar_unlocked()
- puts()
- remove()
- rewind()
- scanf()
- setbuf()
- setvbuf()
- snprintf()
- sprintf()
- sscanf()
- stderr_init()
- stderr_close()
- stdin_init()
- stdin_close()
- stdout_init()
- stdout_close()
- vdprintf()
- vscanf()
- vsscanf()
- vfscanf()
- vprintf()
- vsnprintf()
- vsprintf()
- vfprintf()
- ungetc()
- Do-nothing Stubs
- STDIO Library Calls
- Unison LIBC Library
- Unison I/O Servers
- Graphics, Camera, Video, Audio
- Network Protocols
- TCP and UDP Server - tcpd
- DHCP Client Service - dhcp client
- DHCP Server - dhcpd
- Telnet Server - telnetd
- Tiny FTP Server - tftpd
- Point to Point - pppd
- Network Translation - NAT with PAT
- Firewall
- Tiny HTTP Server - thttpd
- Tiny HTTP Server with TLS
- POP3 Server
- Simple Mail Transfer Protocol Services (SMTP)
- Bootp Protocol
- File Transfer Protocol Server (FTP)
- File Transfer Client Services
- RPC / XDR
- DNS Client
- HTTP/HTTPS Client
- REST Client
- AutoIP Service - autoip client
- mDNS server - mdnsd
- SNTP Client
- SNMP Agent - Snmpd server
- SSL/TLS library
- SSH server
- IP security
- Power Control
- Serial I/O
- System Services
- Universal Serial Bus (USB)
- Wireless
- Remedy Tools for Unison
7.29.2.Login Service - login_services #
NAME
Login Services – login_services
SYNOPSIS
#include <login.h>
- int init_login_table( char * loginfile)
- int add_user( char *user, char * pswd )
- int delete_user( char *user)
- int check_password( char *user, char * pswd )
- int update_password( char *user, char * oldpswd, char * pswd )
- void set_loginfile(char * loginfile)
DESCRIPTION
The login services are provided by the login library. These login services allow add users and password, identify users , check passwords, update user password in login file.
Functions description:
-
- init_login_table – makes first initialization of login table, creates login file. Adds administrator user.
Parameters:
-
-
- loginfile – pointer to the login file. Will be modified after return from function.
-
-
- add_user – adds new user into login table.
Parameters:
-
-
- user – pointer to new user name string.
- pswd – pointer to new user password string.
-
-
- delete_user – deletes existing user from login table.
Parameters:
-
-
- user – pointer to existing user name string.
-
-
- check_password – checks if the user and password are exist in login table.
Parameters:
-
-
- user – pointer to user name string for checking.
- pswd – pointer to user password string for checking.
-
-
- update_password – searches for specific user and changes his password.
Parameters:
-
-
- user – pointer to user name string to search.
- oldpswd – pointer to old password string for changing.
- pswd – pointer to new password string.
-
-
- set_loginfile – sets the specified file for using in component engine.
Parameters:
-
-
- loginfile – pointer to the login file.
-
RETURN VALUES
All login functions return 0 on success, -2 on a missing user if the password is being updated and -1 on all other conditions like missing login file or failed user – password.
ERRORS
All errors are handled by the return values.
EXAMPLE
const char htpasswd_name[] = "/dev/rd/thttp/top_secret/.htpasswd"; THREAD Main(void *arg) { ... set_loginfile((char *)htpasswd_name); //set login and pass to access to files in this dir init_login_table((char *)htpasswd_name); add_user( "root", "root" ); ... // check user name and password in login file if (check_password(request->hr_authuser, request->hr_authpass )) return -1; else return 0; }
NOTES
Coding password do with cryptographic hash algorithm SHA-1.