File: nsswitch.c 327: staticint 328: nss_load_library (service_user *ni) 329: { 330: if (ni->library == NULL) 331: { 332: /* This service has not yet been used. Fetch the service 333: library for it, creating a new one if need be. If there 334: is no service table from the file, this static variable 335: holds the head of the service_library list made from the 336: default configuration. */ 337: static name_database default_table; 338: ni->library = nss_new_service (service_table ?: &default_table, 339: ni->name); //若ni->library的值为NULL,那么就会新建一个ni->library并将成员都进行初始化 340: if (ni->library == NULL) 341: return-1; 342: } 343: 344: if (ni->library->lib_handle == NULL) //由于ni->library刚新建,因此ni->library->lib_handle必定为NULL 345: { 346: /* Load the shared library. */ 347: size_t shlen = (7 + strlen (ni->name) + 3 348: + strlen (__nss_shlib_revision) + 1); 349: int saved_errno = errno; 350: char shlib_name[shlen]; 351: 352: /* Construct shared object name. */ 353: __stpcpy (__stpcpy (__stpcpy (__stpcpy (shlib_name, 354: "libnss_"), 355: ni->name), 356: ".so"), //shalib_name是根据拼接得到 357: __nss_shlib_revision); 358: 359: ni->library->lib_handle = __libc_dlopen (shlib_name); //加载动态链接库 ...
File: locale\findlocale.c 101: struct __locale_data * 102: _nl_find_locale (constchar *locale_path, size_t locale_path_len, 103: int category, constchar **name) 104: { ... 184: /* LOCALE can consist of up to four recognized parts for the XPG syntax: 185: 186: language[_territory[.codeset]][@modifier] 187: 188: Beside the first all of them are allowed to be missing. If the 189: full specified locale is not found, the less specific one are 190: looked for. The various part will be stripped off according to 191: the following order: 192: (1) codeset 193: (2) normalized codeset 194: (3) territory 195: (4) modifier 196: */ /* 区域的格式为C_en_US.UTF-8@XXXXXX _nl_explode_name用于判断(1)(2)(3)(4)哪部分存在,哪部分缺失 */ 197: mask = _nl_explode_name (loc_name, &language, &modifier, &territory, 198: &codeset, &normalized_codeset); 199: if (mask == -1) 200: /* Memory allocate problem. */ 201: returnNULL; 202: //locale_file则给区域设置进行动态内存的分配 205: locale_file = _nl_make_l10nflist (&_nl_locale_file_list[category], 206: locale_path, locale_path_len, mask, 207: language, territory, codeset, 208: normalized_codeset, modifier, 209: _nl_category_names_get (category), 0); //返回NULL 210: 211: if (locale_file == NULL) 212: { 213: /* Find status record for addressed locale file. We have to search 214: through all directories in the locale path. */ 215: locale_file = _nl_make_l10nflist (&_nl_locale_file_list[category], 216: locale_path, locale_path_len, mask, 217: language, territory, codeset, 218: normalized_codeset, modifier, 219: _nl_category_names_get (category), 1); 220: if (locale_file == NULL) 221: /* This means we are out of core. */ 222: returnNULL; 223: } }
--- a/plugins/sudoers/sudoers.c Sat Jan 2308:43:592021-0700 +++ b/plugins/sudoers/sudoers.c Sat Jan 2308:43:592021-0700 @@ -547,7 +547,7 @@
/* If run as root with SUDO_USER set, set sudo_user.pw to that user. */ /* XXX - causes confusion when root is not listed in sudoers */ - if (sudo_mode & (MODE_RUN | MODE_EDIT) && prev_user != NULL) { + if (ISSET(sudo_mode, MODE_RUN|MODE_EDIT) && prev_user != NULL) { if (user_uid == 0 && strcmp(prev_user, "root") != 0) { structpasswd *pw;