diff plugins/password/helpers/chgvirtualminpasswd.c @ 0:1e000243b222

vanilla 1.3.3 distro, I hope
author Charlie Root
date Thu, 04 Jan 2018 15:50:29 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/password/helpers/chgvirtualminpasswd.c	Thu Jan 04 15:50:29 2018 -0500
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <unistd.h>
+
+// set the UID this script will run as (root user)
+#define UID 0
+#define CMD "/usr/sbin/virtualmin"
+
+/* INSTALLING:
+  gcc -o chgvirtualminpasswd chgvirtualminpasswd.c
+  chown root.apache chgvirtualminpasswd
+  strip chgvirtualminpasswd
+  chmod 4550 chgvirtualminpasswd
+*/
+
+main(int argc, char *argv[])
+{
+  int rc,cc;
+
+  cc = setuid(UID);
+  rc = execvp(CMD, argv);
+  if ((rc != 0) || (cc != 0))
+  {
+    fprintf(stderr, "__ %s:  failed %d  %d\n", argv[0], rc, cc);
+    return 1;
+  }
+
+  return 0;
+}