Bugzilla – Attachment 3568 Details for
Bug 3384
Feature proposal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Test program
0002-Add-test-program-for-authentication-reporting.patch (text/plain), 3.52 KB, created by
Thomas Koeller
on 2022-01-30 11:45:31 AEDT
(
hide
)
Description:
Test program
Filename:
MIME Type:
Creator:
Thomas Koeller
Created:
2022-01-30 11:45:31 AEDT
Size:
3.52 KB
patch
obsolete
>From ffd2b64c08d6970fef77859d2a5b30c9c4fb2917 Mon Sep 17 00:00:00 2001 >Message-Id: <ffd2b64c08d6970fef77859d2a5b30c9c4fb2917.1643473104.git.thomas@koeller.dyndns.org> >In-Reply-To: <cover.1643473104.git.thomas@koeller.dyndns.org> >References: <cover.1643473104.git.thomas@koeller.dyndns.org> >From: Thomas Koeller <thomas@koeller.dyndns.org> >Date: Fri, 28 Jan 2022 02:02:25 +0100 >Subject: [PATCH 2/3] Add test program for authentication reporting > >A test program is added for the planned 'authentication result reporting' >feature. This also demonstrates use of that feature. > >Signed-off-by: Thomas Koeller <thomas@koeller.dyndns.org> >--- > authreport-test/.gitignore | 2 + > authreport-test/authreport-sockettest.c | 79 +++++++++++++++++++++++++ > 2 files changed, 81 insertions(+) > create mode 100644 authreport-test/.gitignore > create mode 100644 authreport-test/authreport-sockettest.c > >diff --git a/authreport-test/.gitignore b/authreport-test/.gitignore >new file mode 100644 >index 00000000..24792770 >--- /dev/null >+++ b/authreport-test/.gitignore >@@ -0,0 +1,2 @@ >+authreport-sockettest >+ >diff --git a/authreport-test/authreport-sockettest.c b/authreport-test/authreport-sockettest.c >new file mode 100644 >index 00000000..f8fd6e8d >--- /dev/null >+++ b/authreport-test/authreport-sockettest.c >@@ -0,0 +1,79 @@ >+ >+/* >+ * Copyright (c) 2022 Thomas Koeller. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR >+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. >+ * IN NO EVENT SHALL THE AUTHOR 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. >+ */ >+ >+#include <error.h> >+#include <errno.h> >+#include <unistd.h> >+#include <stdlib.h> >+#include <stdio.h> >+#include <signal.h> >+#include <sys/socket.h> >+#include <sys/un.h> >+ >+static const struct sockaddr_un sa = { >+ .sun_family = AF_UNIX, >+ .sun_path = "/tmp/authreport-test" >+}; >+ >+static void >+cleanup(void) >+{ >+ unlink(sa.sun_path); >+} >+ >+static void >+sh(int) >+{ >+ cleanup(); >+}; >+ >+int >+main(void) >+{ >+ char inbuf[100]; >+ >+ static const struct sigaction sact = { >+ .sa_handler = sh >+ }; >+ >+ const int s = socket(sa.sun_family, SOCK_DGRAM, 0); >+ if (s < 0) { >+ error(1, errno, "Socket creation failed"); >+ } >+ >+ if (bind(s, (const struct sockaddr *) &sa, SUN_LEN(&sa)) < 0) { >+ error(1, errno, "Failed to bind socket address %s", sa.sun_path); >+ } >+ atexit(cleanup); >+ sigaction(SIGINT, &sact, NULL); >+ >+ while (recv(s, inbuf, sizeof inbuf, 0) > 0) { >+ puts(inbuf); >+ memset(inbuf, 0, sizeof inbuf); >+ } >+ >+ exit(0); >+} >+ >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3384
:
3566
|
3567
| 3568 |
3569