ipacct soft quota implementation
Changes
quota.stats:
- new database format
- changed from 3 to 7 fields, now holds Squota, maxT, T0 and warn too
- Hquota, Squota are 64 bit values now
- file permissions set to 0644
ipquota/ipquota.h:
- Added WARN warning flag
- Changed struct user_has_s:
- now holds Squota, maxT, T0 and warn too
- Hquota and Squota are long long values now
- Removed function prototypes:
- change_user, change_all
- Added function prototypes:
- add_user, remove_user, set_quota_user, set_quota_all, modify_quota_user, set_RSquota_user, set_RSquota_all
- Added DB_UMASK database creation umask value
ipquota/database.c:
- init_database()
- adapted to read new database format
- uses DB_UMASK to set file permissions of created database file
- close_database()
- adapted to write new database format
- uses DB_UMASK to set file permissions of created database file
ipquota/hash.c:
- add_user()
- puts Squota, maxT, T0 and warn in struct user_hash_s
- no longer processes data, only stores it
- expects long long values for Hquota, Squota
- remove_user()
- new function: removes user from quota database
- resets user IP access to enabled this is needed because ctrl_access_all only knows about uids in the quota database
- set_quota_user()
- new function: modifies user quota settings
- only sets/modifies quota settings, does not process them
- expects long long values for Hquota, Squota
- generates warning when setting quota of a non-existant user
- set_quota_all()
- new function: modifies quota settings for all users
- only sets/modifies quota settings, does not process them
- expects long long values for Hquota, Squota
- set_RSquota_user()
- new function: sets Squota as a percentage of current Hquota
- only sets/modifies quota settings, does not process them
- generates warning when setting quota of a non-existant user
- set_RSquota_all()
- new function: sets Squota as a percentage of current Hquota, for each user
- only sets/modifies quota settings, does not process them
- modify_quota_user()
- new function: applies ip consumption to user quota
- only modifies quota, does not process it
- ignores attempts to modify quota of non-existant user
- check_quota_all()
- new function: checks quota of all users
- only modifies T0, flags and warn
- triggers warnings at beginning of grace period
- change_user()
- removed function
- change_all()
- removed function
ipquota/log.c: no changes
ipquota/version.c: no changes
ipquota/ipadd.c:
- usage()
- changed to reflect new interface
- main()
- added commandline handling for extra arguments
- checks quotas after setting quotas
- completely rewrote commandline handling and extended user interface
- arg_to_numb()
- new function: converts a commandline argument to a signed long long value
- arg_to_time()
- new function: converts a commandline argument to a time_t value
- arg_to_uid()
- new function: converts a commandline argument to a struct passwd
- process_arguments()
- new function: processes commandline arguments
ipquota/ipquota.c:
- main()
- no longer applies access control before reading input
- checks quotas after processing all input
ipquota/sayip.c:
- main()
- adapted I/O to new database format
- SLL_to_human()
- new function, takes a signed long long byte value and converts it to human readable format
- TT_to_human()
- new function, takes a time_t time value and converts it to human readable format
- arg_to_uid()
- new function: converts a commandline argument to a struct passwd
ipquota/ipquarn.c
- new file: skeleton source for soft quota warning handling application
