Unit Instance
Units API.
See the Weblate's Web API documentation for detailed description of the API.
GET /api/units/100455/?format=api
https://translate-dev.freebsd.org/api/translations/freebsd-doc/articles_pam/en/?format=api", "source": [ "/*-\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n * products derived from this software without specific prior written\n * permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $P4: //depot/projects/openpam/modules/pam_unix/pam_unix.c#3 $\n * $FreeBSD: head/en_US.ISO8859-1/articles/pam/pam_unix.c 38826 2012-05-17 19:12:14Z hrs $\n */\n\n#include <sys/param.h>\n\n#include <pwd.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <security/pam_modules.h>\n#include <security/pam_appl.h>\n\n#ifndef _OPENPAM\nstatic char password_prompt[] = \"Password:\";\n#endif\n\n#ifndef PAM_EXTERN\n#define PAM_EXTERN\n#endif\n\nPAM_EXTERN int\npam_sm_authenticate(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n#ifndef _OPENPAM\n\tstruct pam_conv *conv;\n\tstruct pam_message msg;\n\tconst struct pam_message *msgp;\n\tstruct pam_response *resp;\n#endif\n\tstruct passwd *pwd;\n\tconst char *user;\n\tchar *crypt_password, *password;\n\tint pam_err, retry;\n\n\t/* identify user */\n\tif ((pam_err = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS)\n\t\treturn (pam_err);\n\tif ((pwd = getpwnam(user)) == NULL)\n\t\treturn (PAM_USER_UNKNOWN);\n\n\t/* get password */\n#ifndef _OPENPAM\n\tpam_err = pam_get_item(pamh, PAM_CONV, (const void **)&conv);\n\tif (pam_err != PAM_SUCCESS)\n\t\treturn (PAM_SYSTEM_ERR);\n\tmsg.msg_style = PAM_PROMPT_ECHO_OFF;\n\tmsg.msg = password_prompt;\n\tmsgp = &msg;\n#endif\n\tfor (retry = 0; retry < 3; ++retry) {\n#ifdef _OPENPAM\n\t\tpam_err = pam_get_authtok(pamh, PAM_AUTHTOK,\n\t\t (const char **)&password, NULL);\n#else\n\t\tresp = NULL;\n\t\tpam_err = (*conv->conv)(1, &msgp, &resp, conv->appdata_ptr);\n\t\tif (resp != NULL) {\n\t\t\tif (pam_err == PAM_SUCCESS)\n\t\t\t\tpassword = resp->resp;\n\t\t\telse\n\t\t\t\tfree(resp->resp);\n\t\t\tfree(resp);\n\t\t}\n#endif\n\t\tif (pam_err == PAM_SUCCESS)\n\t\t\tbreak;\n\t}\n\tif (pam_err == PAM_CONV_ERR)\n\t\treturn (pam_err);\n\tif (pam_err != PAM_SUCCESS)\n\t\treturn (PAM_AUTH_ERR);\n\n\t/* compare passwords */\n\tif ((!pwd->pw_passwd[0] && (flags & PAM_DISALLOW_NULL_AUTHTOK)) ||\n\t (crypt_password = crypt(password, pwd->pw_passwd)) == NULL ||\n\t strcmp(crypt_password, pwd->pw_passwd) != 0)\n\t\tpam_err = PAM_AUTH_ERR;\n\telse\n\t\tpam_err = PAM_SUCCESS;\n#ifndef _OPENPAM\n\tfree(password);\n#endif\n\treturn (pam_err);\n}\n\nPAM_EXTERN int\npam_sm_setcred(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_acct_mgmt(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_open_session(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_close_session(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_chauthtok(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SERVICE_ERR);\n}\n\n#ifdef PAM_MODULE_ENTRY\nPAM_MODULE_ENTRY(\"pam_unix\");\n#endif\n" ], "previous_source": "", "target": [ "/*-\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n * products derived from this software without specific prior written\n * permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $P4: //depot/projects/openpam/modules/pam_unix/pam_unix.c#3 $\n * $FreeBSD: head/en_US.ISO8859-1/articles/pam/pam_unix.c 38826 2012-05-17 19:12:14Z hrs $\n */\n\n#include <sys/param.h>\n\n#include <pwd.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <security/pam_modules.h>\n#include <security/pam_appl.h>\n\n#ifndef _OPENPAM\nstatic char password_prompt[] = \"Password:\";\n#endif\n\n#ifndef PAM_EXTERN\n#define PAM_EXTERN\n#endif\n\nPAM_EXTERN int\npam_sm_authenticate(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n#ifndef _OPENPAM\n\tstruct pam_conv *conv;\n\tstruct pam_message msg;\n\tconst struct pam_message *msgp;\n\tstruct pam_response *resp;\n#endif\n\tstruct passwd *pwd;\n\tconst char *user;\n\tchar *crypt_password, *password;\n\tint pam_err, retry;\n\n\t/* identify user */\n\tif ((pam_err = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS)\n\t\treturn (pam_err);\n\tif ((pwd = getpwnam(user)) == NULL)\n\t\treturn (PAM_USER_UNKNOWN);\n\n\t/* get password */\n#ifndef _OPENPAM\n\tpam_err = pam_get_item(pamh, PAM_CONV, (const void **)&conv);\n\tif (pam_err != PAM_SUCCESS)\n\t\treturn (PAM_SYSTEM_ERR);\n\tmsg.msg_style = PAM_PROMPT_ECHO_OFF;\n\tmsg.msg = password_prompt;\n\tmsgp = &msg;\n#endif\n\tfor (retry = 0; retry < 3; ++retry) {\n#ifdef _OPENPAM\n\t\tpam_err = pam_get_authtok(pamh, PAM_AUTHTOK,\n\t\t (const char **)&password, NULL);\n#else\n\t\tresp = NULL;\n\t\tpam_err = (*conv->conv)(1, &msgp, &resp, conv->appdata_ptr);\n\t\tif (resp != NULL) {\n\t\t\tif (pam_err == PAM_SUCCESS)\n\t\t\t\tpassword = resp->resp;\n\t\t\telse\n\t\t\t\tfree(resp->resp);\n\t\t\tfree(resp);\n\t\t}\n#endif\n\t\tif (pam_err == PAM_SUCCESS)\n\t\t\tbreak;\n\t}\n\tif (pam_err == PAM_CONV_ERR)\n\t\treturn (pam_err);\n\tif (pam_err != PAM_SUCCESS)\n\t\treturn (PAM_AUTH_ERR);\n\n\t/* compare passwords */\n\tif ((!pwd->pw_passwd[0] && (flags & PAM_DISALLOW_NULL_AUTHTOK)) ||\n\t (crypt_password = crypt(password, pwd->pw_passwd)) == NULL ||\n\t strcmp(crypt_password, pwd->pw_passwd) != 0)\n\t\tpam_err = PAM_AUTH_ERR;\n\telse\n\t\tpam_err = PAM_SUCCESS;\n#ifndef _OPENPAM\n\tfree(password);\n#endif\n\treturn (pam_err);\n}\n\nPAM_EXTERN int\npam_sm_setcred(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_acct_mgmt(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_open_session(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_close_session(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SUCCESS);\n}\n\nPAM_EXTERN int\npam_sm_chauthtok(pam_handle_t *pamh, int flags,\n\tint argc, const char *argv[])\n{\n\n\treturn (PAM_SERVICE_ERR);\n}\n\n#ifdef PAM_MODULE_ENTRY\nPAM_MODULE_ENTRY(\"pam_unix\");\n#endif\n" ], "id_hash": -8076476969926511498, "content_hash": -8076476969926511498, "location": "article.translate.xml:1450", "context": "", "note": "(itstool) path: appendix/programlisting", "flags": "no-wrap", "labels": [], "state": 100, "fuzzy": false, "translated": true, "approved": false, "position": 228, "has_suggestion": false, "has_comment": false, "has_failing_check": false, "num_words": 598, "source_unit": "https://translate-dev.freebsd.org/api/units/100455/?format=api", "priority": 100, "id": 100455, "web_url": "https://translate-dev.freebsd.org/translate/freebsd-doc/articles_pam/en/?checksum=0fea96fca2e83476", "url": "https://translate-dev.freebsd.org/api/units/100455/?format=api", "explanation": "", "extra_flags": "", "pending": false, "timestamp": "2019-10-20T12:13:59.458269Z" }{ "translation": "