Do any of you have a good C wrapper program that checks two agrument values syntax, to make sure they are just characters, and then these agruments are passed to a perl script. This Perl script sets the effective UID, "which is root" and then it untaints the agruments so that it can be run as suid.

The C wrapper and everything else works fine, but I want to be able to check the syntax of the two agruments in C, before they are passed to the perl script, and I'm not sure how to do that.

Here's my C wrapper
* * ldap-group.c by Kory Wheatley * Idaho State University * September 29, 2003 * This is an suid wrapper for the ldapgroup program. */ #include <stdio.h> #include <string.h> #include <unistd.h> /* for exec */ main(argc, argv) int argc; char *argv []; { /* Make sure at least one argument is passed to this program */ if (argc < 2) { printf ("Usage: ldap-group [-p] trans \n"); exit(1); } /* execute the perl script */ execv("/opt/bin/techweb-changes.pl",argv); } /* END OF MAIN PROGRAM */

edited: Mon Sep 29 22:37:22 2003 by jeffa - code tags, p tags


In reply to passing c agruments to Perl by koryw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.