libkylin-chkname/0000775000175000017500000000000015167363576012744 5ustar fengfenglibkylin-chkname/Makefile.am0000664000175000017500000000026315160500012014744 0ustar fengfenglib_LTLIBRARIES=libkylin_chkname.la libkylin_chkname_la_SOURCES=kylin-chkname.c include_HEADERS=kylin-chkname.h SUBDIRS = po ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = m4/ChangeLog libkylin-chkname/configure.ac0000664000175000017500000000117715167363576015240 0ustar fengfeng# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) AC_INIT([libkylin-chkname], [1.0], [mengyuan@kylinos.cn]) AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_LIBTOOL # Checks for libraries. AM_GNU_GETTEXT_VERSION([0.22]) AM_GNU_GETTEXT([external]) # Checks for header files. AC_CHECK_HEADERS([libintl.h string.h syslog.h]) # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_CHECK_FUNCS([strerror]) AC_OUTPUT([Makefile po/Makefile.in]) libkylin-chkname/reserved-names0000664000175000017500000000225315160500012015554 0ustar fengfeng# Static users from base-passwd/passwd.master (3.5.11). root daemon bin sys sync games man lp mail news uucp proxy www-data backup list irc gnats nobody # Other static groups from base-passwd/group.master (3.5.11). adm tty disk kmem dialout fax voice cdrom floppy tape sudo audio dip operator src shadow utmp video sasl plugdev staff users nogroup # Reserved usernames listed in base-passwd/README (3.5.11). netplan ftn mysql tac-plus alias qmail qmaild qmails qmailr qmailq qmaill qmailp asterisk vpopmail vchkpw # Ubuntu creates the admin group and adds the first user to it in order to # grant them sudo privileges. admin # Other miscellaneous system users/groups created by common packages. While # it's useful to add things here that people might run into, it's not # absolutely critical; the worst that will happen is that the installation # will fail at some later point. Debian-exim bind crontab cupsys dcc dhcp dictd dovecot fetchmail firebird ftp fuse gdm haldaemon hplilp identd jwhois klog lpadmin maas messagebus mythtv netdev powerdev radvd saned sbuild scanner slocate ssh sshd ssl-cert sslwrap statd syslog telnetd tftpd # kylin reserved administrator users secadm auditadm libkylin-chkname/AUTHORS0000664000175000017500000000003715160507663014002 0ustar fengfengmengyuan libkylin-chkname/kylin-chkname.c0000664000175000017500000001046715160507663015640 0ustar fengfeng/* * SPDX-License-Identifier: MulanPSL-2.0 * * Copyright (c) 2026 KylinSoft Co., Ltd. */ #include #include #include #include #include #include #include "kylin-chkname.h" #define USERNAME_MAXLEN 32 #define RESERVED_NAMES "/usr/share/kylin-chkname/reserved-names" #define _(STRING) gettext(STRING) static int reserve_check(const char *name) { FILE *fp; char buf[USERNAME_MAXLEN+2]; int find = 0; fp = fopen(RESERVED_NAMES, "r"); if (NULL == fp) { syslog(LOG_INFO, "Open reserved-names file failed: %s", strerror(errno)); find = 2; return find; } while (fgets(buf, USERNAME_MAXLEN+2, fp) != NULL) { if (!strlen(buf) || !strncmp(buf, "#", 1)) continue; buf[strlen(buf) - 1] = '\0'; if (!strcmp(name, buf)) { find = 1; break; } } fclose(fp); return find; } int kylin_username_check(const char *name, int reserve) { /* * User/group names must match gnu e-regex: * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]? * * as a non-POSIX, extension, allow "$" as the last char for * sake of Samba 3.x "add machine script" * * Also do not allow fully numeric, hexadecimal, octal number names * or just "." or "..". */ if (name == NULL) return NAME_ERROR; if (strlen(name) == 0 || strlen(name) > USERNAME_MAXLEN) return LENGTH_ERROR; if (reserve && reserve_check(name)) { if (reserve_check(name) == 1) return RESERVED_ERROR; else return OPEN_RESERVED_NAMES_ERROR; } if ('.' == *name && (('.' == name[1] && '\0' == name[2]) || '\0' == name[1])) return REGEX_ERROR; if (!((*name >= 'a' && *name <= 'z') || (*name >= 'A' && *name <= 'Z') || (*name >= '0' && *name <= '9') || *name == '_' || *name == '.')) return FIRST_CHAR_ERROR; int numberic = 1; int hex = 1; int octal = 1; int chars_checked = 1; if (*name != '0' || *(name + 1) != 'x') hex = 0; if (*name != '0' || *(name + 1) != 'o') octal = 0; if (*name < '0' || *name > '9') numberic = 0; while ('\0' != *++name) { if (!((*name >= 'a' && *name <= 'z') || (*name >= 'A' && *name <= 'Z') || (*name >= '0' && *name <= '9') || *name == '_' || *name == '.' || *name == '-' || (*name == '$' && name[1] == '\0'))) return REGEX_ERROR; if (hex && chars_checked >= 2) { if ((*name < '0' || *name > '9') && (*name < 'A' || *name > 'F') && (*name < 'a' || *name > 'f')) hex = 0; } if (octal && chars_checked >= 2) { if (*name < '0' || *name > '7') octal = 0; } if (numberic) { if (*name < '0' || *name > '9') numberic = 0; } chars_checked++; } if (hex) return HEX_ERROR; if (octal) return OCTAL_ERROR; if (numberic) return NUMBERIC_ERROR; return CHECK_SUCCESS; } char *kylin_username_strerror(int err_num) { setlocale(LC_ALL, ""); bindtextdomain("kylin-chkname", "/usr/share/locale"); textdomain("kylin-chkname"); switch(err_num) { case CHECK_SUCCESS: return _("Success"); case LENGTH_ERROR: return _("Username's length must be between 1 and 32 characters"); case REGEX_ERROR: return _("Invalid username regex"); case RESERVED_ERROR: return _("Reserved username"); case NAME_ERROR: return _("Parameter name is null"); case OPEN_RESERVED_NAMES_ERROR: return _("Open reserved-names file failed"); case FIRST_CHAR_ERROR: return _("Username must start with a letter, number, dot, or underscore"); case HEX_ERROR: return _("Username cannot be a hexadecimal number"); case OCTAL_ERROR: return _("Username cannot be octal number"); case NUMBERIC_ERROR: return _("Username cannot be fully numeric"); default: return _("Unknown error"); } } libkylin-chkname/po/0000775000175000017500000000000015160507663013350 5ustar fengfenglibkylin-chkname/po/ky.po0000664000175000017500000000404415160500030014312 0ustar fengfeng# Copyright (C) KylinSoft@Copyright # #, fuzzy msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2025-03-17 16:36+0800\n" "Last-Translator: mengyuan \n" "Language-Team: LANGUAGE \n" "Language: ky\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: kylin-chkname.c:137 msgid "Success" msgstr "Ийгилик" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "" "Колдонуучу атыңыздын узундугу 1 жана 32 тамгалардын ортосунда болушу керек" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "Колдонуучу аты туура эмес регулярдуу выражение" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "Резервдеги колдонуучу аты" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "Колдонуучу аты параметри бош" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "Резервделген аттар файлын ачуу ишке ашпай калды" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "Колдонуучу аты тамга, сан, чекит же асты сызык менен башталышы керек" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "Колдонуучу аты он алтылык сан болушу мүмкүн эмес" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "Колдонуучу аты сегиз сан болушу мүмкүн эмес" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "Колдонуучу аты толук сандык болушу мүмкүн эмес" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "Белгисиз ката" libkylin-chkname/po/zh_CN.po0000664000175000017500000000313715160500030014672 0ustar fengfeng# Copyright (C) 2022 KylinSoft@Copyright # #, fuzzy msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2021-08-30 14:30+0800\n" "Last-Translator: mengyuan \n" "Language-Team: LANGUAGE \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: kylin-chkname.c:137 msgid "Success" msgstr "通过" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "用户名长度必须介于1到32个字符之间" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "非法的用户名格式" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "系统保留用户名" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "参数name为null" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "打开保留名文件错误" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "用户名必须以字母、数字、点或下划线开头" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "用户名不能为16进制数" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "用户名不能为8进制数" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "用户名不能为纯数字" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "未知的错误" #~ msgid "Invaild username length" #~ msgstr "非法的用户名长度" libkylin-chkname/po/kylin-chkname.mo0000664000175000017500000000240615160500012016416 0ustar fengfeng 01I` ' =(5f-4Db~90   Invaild username lengthInvalid username regexOpen reserved-names file failedParameter name is nullReserved usernameSuccessUnknown errorUsername cannot be a hexadecimal numberUsername cannot be fully numericUsername cannot be octal numberUsername must start with a letter, number, dot, or underscoreUsername's length must be between 1 and 32 charactersProject-Id-Version: kylin-chkname Report-Msgid-Bugs-To: PO-Revision-Date: 2021-08-30 14:30+0800 Last-Translator: mengyuan Language-Team: LANGUAGE Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 非法的用户名长度非法的用户名格式打开保留名文件错误参数name为null系统保留用户名通过未知的错误用户名不能为16进制数用户名不能为纯数字用户名不能为8进制数用户名必须以字母、数字、点或下划线开头用户名长度必须介于1到32个字符之间libkylin-chkname/po/mn.po0000664000175000017500000000616415160500030014306 0ustar fengfeng# Copyright (C) 2022 KylinSoft@Copyright # msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2023-08-03 03:08+0000\n" "Last-Translator: kylinmy \n" "Language-Team: Mongolian \n" "Language: mn\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.12.1-dev\n" #: kylin-chkname.c:137 msgid "Success" msgstr "ᠦᠩᠬᠡᠷᠡᠪᠡ" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "" "ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠵᠢᠨ ᠤᠷᠳᠤ ᠨᠢ ᠡᠷᠬᠡᠪᠰᠢ1 ᠡᠴᠡ32 ᠦᠰᠦᠭ ᠳᠡᠮᠳᠡᠭ ᠤ᠋ᠨ ᠬᠤᠭᠤᠷᠤᠨᠳᠤ " "ᠪᠠᠢᠬᠤ ᠬᠡᠷᠡᠭᠳᠡᠢ" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "ᠬᠠᠤᠯᠢ ᠪᠤᠰᠤ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠵᠢᠨ ᠵᠠᠭᠪᠤᠷ" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "ᠰᠢᠰᠲ᠋ᠧᠮ ᠤ᠋ᠨ ᠬᠠᠳᠠᠭᠠᠯᠠᠵᠤ ᠦᠯᠡᠳᠡᠭᠡᠭᠰᠡᠨ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "ᠪᠤᠯᠵᠣᠯᠲᠤ ᠲᠣᠭ᠎ᠠ ᠨᠢ ᠬᠣᠭᠣᠰᠣᠨ ᠪᠠᠶᠢᠵᠤ ᠪᠣᠯᠬᠤ ᠦᠭᠡᠢ ᠃" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "ᠨᠡᠬᠡᠬᠡᠭᠰᠡᠨ ᠦᠯᠡᠳᠡᠭᠡᠵᠤ ᠬᠠᠳᠠᠭᠠᠯᠠᠭᠰᠠᠨ ᠹᠠᠢᠯ ᠢ᠋ ᠪᠤᠷᠤᠭᠤ" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "" "ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠨᠢ ᠡᠷᠬᠡᠪᠰᠢ ᠠᠪᠢᠶ᠎ᠠ᠂ ᠲᠤᠭ᠎ᠠ᠂ ᠴᠡᠭ ᠪᠤᠶᠤ ᠳᠤᠤᠷ᠎ᠠ ᠵᠢᠷᠤᠭᠠᠰᠤ ᠪᠡᠷ " "ᠡᠬᠢᠯᠡᠭᠰᠡᠨ ᠪᠠᠢᠬᠤ ᠬᠡᠷᠡᠭᠳᠡᠢ" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠨᠢ16 ᠪᠡᠷ ᠳᠠᠪᠰᠢᠬᠤ ᠳᠦᠷᠢᠮ ᠤ᠋ᠨ ᠲᠤᠭ᠎ᠠ ᠪᠠᠢᠵᠤ ᠪᠤᠯᠬᠤ ᠦᠬᠡᠢ" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠨᠢ 8 ᠪᠡᠷ ᠳᠠᠪᠰᠢᠬᠤ ᠳᠦᠷᠢᠮ ᠤ᠋ᠨ ᠲᠤᠭ᠎ᠠ ᠪᠠᠢᠵᠤ ᠪᠤᠯᠬᠤ ᠦᠬᠡᠢ" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠨᠢ ᠴᠤᠯᠤ ᠲᠤᠭ᠎ᠠ ᠪᠠᠢᠵᠤ ᠪᠤᠯᠬᠤ ᠦᠬᠡᠢ" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "ᠦᠯᠦ ᠮᠡᠳᠡᠬᠦ ᠠᠯᠳᠠᠭ᠎ᠠ" #~ msgid "Invaild username length" #~ msgstr "ᠬᠠᠤᠯᠢ ᠪᠤᠰᠤ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ ᠵᠢᠨ ᠤᠷᠳᠤ" libkylin-chkname/po/LINGUAS0000664000175000017500000000003615160500012014351 0ustar fengfengbo_CN kk ky mn ug zh_CN zh_HK libkylin-chkname/po/Makevars0000664000175000017500000000676415160500012015036 0ustar fengfeng# Makefile variables for PO directory in any package using GNU gettext. # # Copyright (C) 2003-2019 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation gives # unlimited permission to use, copy, distribute, and modify it. # Usually the message domain is the same as the package name. DOMAIN = kylin-chkname # These two variables depend on the location of this directory. top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = KylinSoft Co., Ltd. [2025].All rights reserved. # This tells whether or not to prepend "GNU " prefix to the package # name that gets inserted into the header of the $(DOMAIN).pot file. # Possible values are "yes", "no", or empty. If it is empty, try to # detect it automatically by scanning the files in $(top_srcdir) for # "GNU packagename" string. PACKAGE_GNU = # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' # context. Possible values are "yes" and "no". Set this to yes if the # package uses functions taking also a message context, like pgettext(), or # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. USE_MSGCTXT = no # These options get passed to msgmerge. # Useful options are in particular: # --previous to keep previous msgids of translated messages, # --quiet to reduce the verbosity. MSGMERGE_OPTIONS = # These options get passed to msginit. # If you want to disable line wrapping when writing PO files, add # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and # MSGINIT_OPTIONS. MSGINIT_OPTIONS = # This tells whether or not to regenerate a PO file when $(DOMAIN).pot # has changed. Possible values are "yes" and "no". Set this to no if # the POT file is checked in the repository and the version control # program ignores timestamps. PO_DEPENDS_ON_POT = yes # This tells whether or not to forcibly update $(DOMAIN).pot and # regenerate PO files on "make dist". Possible values are "yes" and # "no". Set this to no if the POT file and PO files are maintained # externally. DIST_DEPENDS_ON_UPDATE_PO = yes libkylin-chkname/po/kk.po0000664000175000017500000000410215160500030014267 0ustar fengfeng# Copyright (C) 2025 KylinSoft@Copyright # #, fuzzy msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2025-03-18 14:30+0800\n" "Last-Translator: mengyuan \n" "Language-Team: LANGUAGE \n" "Language: kk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: kylin-chkname.c:137 msgid "Success" msgstr "Сәттілік" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "Пайдаланушы атының ұзындығы 1-ден 32 таңбаға дейін болуы тиіс" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "Жарамсыз пайдаланушы аты регексі" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "Сақталған пайдаланушы аты" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "Параметр атауы - нөл" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "Сақталған атаулар файлын ашу жаңылысы" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "" "Пайдаланушы аты әріптен, саннан, нүктеден немесе астын сызып бастау керек" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "Пайдаланушы аты гексадецималды сан бола алмайды" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "Пайдаланушы аты сегіздік сан бола алмайды" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "Пайдаланушы аты толық сан бола алмайды" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "Беймәлім қате" #~ msgid "Invaild username length" #~ msgstr "Қолы жоқ пайдаланушы атының ұзындығы" libkylin-chkname/po/zh_HK.po0000664000175000017500000000314315160500030014671 0ustar fengfeng# Copyright (C) 2022 KylinSoft@Copyright # #, fuzzy msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2021-08-30 14:30+0800\n" "Last-Translator: mengyuan \n" "Language-Team: LANGUAGE \n" "Language: zh_HK\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: kylin-chkname.c:137 msgid "Success" msgstr "成功" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "用戶名長度必須介於1到32個字符之間" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "非法的用戶名格式" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "系統保留用戶名" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "參數名稱為空" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "打開保留名稱檔失敗" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "用戶名必須以字母、數位、點或下劃線開頭" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "用戶名不能是十六進位數" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "用戶名不能是八進位數" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "用戶名不能為純數字" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "未知錯誤" #~ msgid "Invaild username length" #~ msgstr "非法的用戶名長度" libkylin-chkname/po/POTFILES.in0000664000175000017500000000011315160500012015075 0ustar fengfeng# List of source files which contain translatable strings. kylin-chkname.c libkylin-chkname/po/bo_CN.po0000664000175000017500000000600215160500030014643 0ustar fengfeng# Copyright (C) 2022 KylinSoft@Copyright # msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2022-07-08 06:12+0000\n" "Last-Translator: kylinmy \n" "Language-Team: Tibetan (China) \n" "Language: bo_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 4.12.1-dev\n" #: kylin-chkname.c:137 msgid "Success" msgstr "ལེགས་འགྲུབ་བྱུང་བ།" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "སྤྱོད་མཁན་གྱི་རིང་ཚད་ནི་ངེས་པར་དུ་ཡི་གེ་1ནས་32བར་ཡིན་དགོས།" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "གོ་མི་ཆོད་པའི་སྤྱོད་མཁན་གྱི་མིང་བསྐྱར་དུ་ཞིབ་འཇུག་བྱས།" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "སོར་ཉར་བྱས་པའི་སྤྱོད་མཁན་གྱི་མིང" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "གྲངས་ཀ་འདིའི་མིང་ནི་གོ་མི་སྲིད་པ་ཞིག་རེད།" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "ཁ་ཕྱེ་ནས་སོར་ཉར་བྱས་པའི་མིང་ཡིག་ཆ་ལ་ཕམ་ཉེས" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "" "སྤྱོད་མཁན་གྱི་མིང་ནི་ངེས་པར་དུ་འཕྲིན་ཡིག་དང་། ཨང་གྲངས། ཚེག་རྡར། ཡང་ན་ནན་བཤད་བཅས་ནས་འགོ་" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "སྤྱོད་མཁན་གྱི་མིང་ནི་ཁེ་བཟང་ཟ་བའི་ཨང་གྲངས་ཡིན་མི་སྲིད།" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "སྤྱོད་མཁན་གྱི་མིང་ནི་ཨང་ཀི་བརྒྱད་པའི་ཨང་གྲངས་ཡིན་མི" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "སྤྱོད་མཁན་གྱི་མིང་ལ་གྲངས་ཀ་ཆ་ཚང་ཞིག་ཡོད་མི་སྲིད།" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "ཤེས་མེད་པའི་ནོར་འཁྲུལ།" #~ msgid "Invaild username length" #~ msgstr "གོ་མི་ཐུབ་པའི་སྤྱོད་མཁན་གྱི་མིང་རིང་ཐུང་།" libkylin-chkname/po/ug.po0000664000175000017500000000405115160500030014300 0ustar fengfeng# Copyright (C) 2025 KylinSoft@Copyright # #, fuzzy msgid "" msgstr "" "Project-Id-Version: kylin-chkname\n" "Report-Msgid-Bugs-To: mengyuan@kylinos.cn\n" "POT-Creation-Date: 2025-09-02 16:52+0800\n" "PO-Revision-Date: 2025-03-17 16:36+0800\n" "Last-Translator: mengyuan \n" "Language-Team: LANGUAGE \n" "Language: ug\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: kylin-chkname.c:137 msgid "Success" msgstr "باشارغۇچىلىق" #: kylin-chkname.c:139 msgid "Username's length must be between 1 and 32 characters" msgstr "ئىشلەتكۈچى نامىنىڭ ئۇزۇنلۇقى 1 دىن 32 ھەرپ ئارىلىقىدا بولۇشى كېرەك" #: kylin-chkname.c:141 msgid "Invalid username regex" msgstr "ئىشلەتكۈچى نامى regex ئىناۋەتسىز" #: kylin-chkname.c:143 msgid "Reserved username" msgstr "قالدۇرۇلغان ئىشلەتكۈچى نامى" #: kylin-chkname.c:145 msgid "Parameter name is null" msgstr "ئابونت نامى پارامېتىرى قۇرۇق" #: kylin-chkname.c:147 msgid "Open reserved-names file failed" msgstr "قالدۇرۇلغان ئىسىملار ھۆججىتىنى ئېچىش مەغلۇپ بولدى" #: kylin-chkname.c:149 msgid "Username must start with a letter, number, dot, or underscore" msgstr "" "ئىشلەتكۈچى نامى ھەرپ، رەقەم، چېكىت ياكى ئاستى بەلگە بىلەن باشلىنىشى كېرەك" #: kylin-chkname.c:151 msgid "Username cannot be a hexadecimal number" msgstr "ئىشلەتكۈچى نامى ئالتە ئونلۇق سان بولالمايدۇ" #: kylin-chkname.c:153 msgid "Username cannot be octal number" msgstr "ئىشلەتكۈچى نامى سەككىز نومۇرلۇق سان بولالمايدۇ" #: kylin-chkname.c:155 msgid "Username cannot be fully numeric" msgstr "ئىشلەتكۈچى نامى پۈتۈنلەي رەقەملىك بولالايدىغان ئەمەس" #: kylin-chkname.c:157 msgid "Unknown error" msgstr "نامەلۇم خاتالىق" libkylin-chkname/COPYING0000664000175000017500000000522315160500030013744 0ustar fengfengMulan Permissive Software License, Version 2 1. Grant of License 1.1 Copyright Grant Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with or without modification. 1.2 Patent Grant Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. 2. Disclaimer of Warranty THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 3. Limitation of Liability IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4. Conditions 4.1 You must cause the modified Software to carry prominent notices stating that You changed the Software. 4.2 You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Software, excluding those notices that do not pertain to any part of the Derivative Works. 4.3 You must provide a copy of this License to any recipient of the Software or Derivative Works. You may choose to offer, and charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. libkylin-chkname/kylin-chkname.h0000664000175000017500000000227015160507663015636 0ustar fengfeng/* * SPDX-License-Identifier: MulanPSL-2.0 * * Copyright (c) 2026 KylinSoft Co., Ltd. */ #ifndef KYLIN_USERNAME_CHECK_H #define KYLIN_USERNAME_CHECK_H #ifdef __cplusplus extern "C" { #endif #define CHECK_SUCCESS 0 #define LENGTH_ERROR -1 #define REGEX_ERROR -2 #define RESERVED_ERROR -3 #define NAME_ERROR -4 #define OPEN_RESERVED_NAMES_ERROR -5 #define FIRST_CHAR_ERROR -6 #define HEX_ERROR -7 #define OCTAL_ERROR -8 #define NUMBERIC_ERROR -9 /* * @brief 检测用户名是否合法 * * @param name 待检测用户名 * @param reserve 是否过滤系统保留用户名 * 1表示过滤(保留用户名为非法用户名),0表示不过滤 * * @return 用户名合法返回0,用户名非法返回负数 */ int kylin_username_check(const char *name, int reserve); /* * @brief 将返回值转为字符串描述 * * @param err_num kylin_username_check接口返回值 * * @return 参数err_num为已知错误时,返回对应的字符串描述; * 未知错误,返回“Unknown error” */ char *kylin_username_strerror(int err_num); #ifdef __cplusplus } #endif #endif /* KYLIN_USERNAME_CHECK_H */