Unit Instance
Units API.
See the Weblate's Web API documentation for detailed description of the API.
GET /api/units/100458/?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 * $FreeBSD: head/en_US.ISO8859-1/articles/pam/converse.c 38826 2012-05-17 19:12:14Z hrs $\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <security/pam_appl.h>\n\nint\nconverse(int n, const struct pam_message **msg,\n\tstruct pam_response **resp, void *data)\n{\n\tstruct pam_response *aresp;\n\tchar buf[PAM_MAX_RESP_SIZE];\n\tint i;\n\n\tdata = data;\n\tif (n <= 0 || n > PAM_MAX_NUM_MSG)\n\t\treturn (PAM_CONV_ERR);\n\tif ((aresp = calloc(n, sizeof *aresp)) == NULL)\n\t\treturn (PAM_BUF_ERR);\n\tfor (i = 0; i < n; ++i) {\n\t\taresp[i].resp_retcode = 0;\n\t\taresp[i].resp = NULL;\n\t\tswitch (msg[i]->msg_style) {\n\t\tcase PAM_PROMPT_ECHO_OFF:\n\t\t\taresp[i].resp = strdup(getpass(msg[i]->msg));\n\t\t\tif (aresp[i].resp == NULL)\n\t\t\t\tgoto fail;\n\t\t\tbreak;\n\t\tcase PAM_PROMPT_ECHO_ON:\n\t\t\tfputs(msg[i]->msg, stderr);\n\t\t\tif (fgets(buf, sizeof buf, stdin) == NULL)\n\t\t\t\tgoto fail;\n\t\t\taresp[i].resp = strdup(buf);\n\t\t\tif (aresp[i].resp == NULL)\n\t\t\t\tgoto fail;\n\t\t\tbreak;\n\t\tcase PAM_ERROR_MSG:\n\t\t\tfputs(msg[i]->msg, stderr);\n\t\t\tif (strlen(msg[i]->msg) > 0 &&\n\t\t\t msg[i]->msg[strlen(msg[i]->msg) - 1] != '\\n')\n\t\t\t\tfputc('\\n', stderr);\n\t\t\tbreak;\n\t\tcase PAM_TEXT_INFO:\n\t\t\tfputs(msg[i]->msg, stdout);\n\t\t\tif (strlen(msg[i]->msg) > 0 &&\n\t\t\t msg[i]->msg[strlen(msg[i]->msg) - 1] != '\\n')\n\t\t\t\tfputc('\\n', stdout);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto fail;\n\t\t}\n\t}\n\t*resp = aresp;\n\treturn (PAM_SUCCESS);\n fail:\n for (i = 0; i < n; ++i) {\n if (aresp[i].resp != NULL) {\n memset(aresp[i].resp, 0, strlen(aresp[i].resp));\n free(aresp[i].resp);\n }\n }\n memset(aresp, 0, n * sizeof *aresp);\n\t*resp = NULL;\n\treturn (PAM_CONV_ERR);\n}\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 * $FreeBSD: head/en_US.ISO8859-1/articles/pam/converse.c 38826 2012-05-17 19:12:14Z hrs $\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#include <security/pam_appl.h>\n\nint\nconverse(int n, const struct pam_message **msg,\n\tstruct pam_response **resp, void *data)\n{\n\tstruct pam_response *aresp;\n\tchar buf[PAM_MAX_RESP_SIZE];\n\tint i;\n\n\tdata = data;\n\tif (n <= 0 || n > PAM_MAX_NUM_MSG)\n\t\treturn (PAM_CONV_ERR);\n\tif ((aresp = calloc(n, sizeof *aresp)) == NULL)\n\t\treturn (PAM_BUF_ERR);\n\tfor (i = 0; i < n; ++i) {\n\t\taresp[i].resp_retcode = 0;\n\t\taresp[i].resp = NULL;\n\t\tswitch (msg[i]->msg_style) {\n\t\tcase PAM_PROMPT_ECHO_OFF:\n\t\t\taresp[i].resp = strdup(getpass(msg[i]->msg));\n\t\t\tif (aresp[i].resp == NULL)\n\t\t\t\tgoto fail;\n\t\t\tbreak;\n\t\tcase PAM_PROMPT_ECHO_ON:\n\t\t\tfputs(msg[i]->msg, stderr);\n\t\t\tif (fgets(buf, sizeof buf, stdin) == NULL)\n\t\t\t\tgoto fail;\n\t\t\taresp[i].resp = strdup(buf);\n\t\t\tif (aresp[i].resp == NULL)\n\t\t\t\tgoto fail;\n\t\t\tbreak;\n\t\tcase PAM_ERROR_MSG:\n\t\t\tfputs(msg[i]->msg, stderr);\n\t\t\tif (strlen(msg[i]->msg) > 0 &&\n\t\t\t msg[i]->msg[strlen(msg[i]->msg) - 1] != '\\n')\n\t\t\t\tfputc('\\n', stderr);\n\t\t\tbreak;\n\t\tcase PAM_TEXT_INFO:\n\t\t\tfputs(msg[i]->msg, stdout);\n\t\t\tif (strlen(msg[i]->msg) > 0 &&\n\t\t\t msg[i]->msg[strlen(msg[i]->msg) - 1] != '\\n')\n\t\t\t\tfputc('\\n', stdout);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto fail;\n\t\t}\n\t}\n\t*resp = aresp;\n\treturn (PAM_SUCCESS);\n fail:\n for (i = 0; i < n; ++i) {\n if (aresp[i].resp != NULL) {\n memset(aresp[i].resp, 0, strlen(aresp[i].resp));\n free(aresp[i].resp);\n }\n }\n memset(aresp, 0, n * sizeof *aresp);\n\t*resp = NULL;\n\treturn (PAM_CONV_ERR);\n}\n" ], "id_hash": -6539785640765174114, "content_hash": -6539785640765174114, "location": "article.translate.xml:1632", "context": "", "note": "(itstool) path: appendix/programlisting", "flags": "no-wrap", "labels": [], "state": 100, "fuzzy": false, "translated": true, "approved": false, "position": 231, "has_suggestion": false, "has_comment": false, "has_failing_check": true, "num_words": 478, "source_unit": "https://translate-dev.freebsd.org/api/units/100458/?format=api", "priority": 100, "id": 100458, "web_url": "https://translate-dev.freebsd.org/translate/freebsd-doc/articles_pam/en/?checksum=253e039be6fdce9e", "url": "https://translate-dev.freebsd.org/api/units/100458/?format=api", "explanation": "", "extra_flags": "", "pending": false, "timestamp": "2019-10-20T12:13:59.511055Z" }{ "translation": "