nis-util
1.0.D108
|
00001 // 00002 // nis-util - NIS Administration Utilities 00003 // Copyright (C) 2001, 2008, 2009, 2011, 2012 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #include <lib/colon/group/slurp/check.h> 00020 #include <lib/colon/passwd/functor/check_group_count.h> 00021 #include <lib/colon/passwd/slurp.h> 00022 00023 #include <nis-util-group/check.h> 00024 00025 00026 void 00027 check(const rcstring &group_filename, const rcstring &passwd_filename) 00028 { 00029 // 00030 // Read the password file. 00031 // 00032 colon_passwd_slurp::pointer psw = 00033 colon_passwd_slurp::create(passwd_filename); 00034 psw->read_and_process(); 00035 00036 // 00037 // Read the group file. 00038 // 00039 colon_group_slurp_check::pointer grp = 00040 colon_group_slurp_check::create(group_filename, psw); 00041 grp->read_and_process(); 00042 00043 // 00044 // Must be the MINIMUM of all NIS client maximums. No point 00045 // asking whatever operating system we are currently on, it will 00046 // probably NOT be the minimum. 00047 // 00048 int max_groups_per_user = 16; 00049 #if 0 00050 int n = sysconf(_SC_NGROUPS_MAX); 00051 if (n > 0) 00052 max_groups_per_user = n; 00053 #endif 00054 colon_passwd_functor_check_group_count chk(max_groups_per_user); 00055 psw->walk(chk); 00056 } 00057 00058 00059 // vim: set ts=8 sw=4 et :