# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= autoselect-ssl VERSION= 2 KEYWORDS= security VARIANTS= standard SDESC[standard]= Dynamic links to SSL program variants HOMEPAGE= none CONTACT= nobody DOWNLOAD_GROUPS= none SPKGS[standard]= single OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none LICENSE= ISCL:single LICENSE_FILE= ISCL:{{FILESDIR}}/LICENSE_ISC LICENSE_SCHEME= solo do-extract: ${MKDIR} ${WRKSRC} ${CP} ${FILESDIR}/Makefile ${WRKSRC}/ ${CP} ${FILESDIR}/autoselect.c.in ${WRKSRC}/ [FILE:779:descriptions/desc.single] This package provides: bin/openssl bin/c_rehash bin/nc bin/ocspcheck There can be up to 5 variants of SSL installed on a system: openssl10, openssl11, openssl30, libressl, and libressl-devel These selector programs will exec one of variants based on the ravenadm's set SSL default and the SSL_VARIANT environment variable. The environment variable has the highest priority. If SSL_VARIANT is set, the search will be limited to /raven/bin/ssl_${SSL_VARIANT}/${ARG0}. If that doesn't exist, an appropriate error will be produced instead. Without the environment directive, the SSL default of the ravenadm profile is checked first, and then this order: openssl30, libressl, openssl11, libressl-devel, openssl10. The program will exec the first variant that it finds. [FILE:39:manifests/plist.single] bin/ c_rehash nc ocspcheck openssl [FILE:742:files/LICENSE_ISC] Copyright (c) 2019, The Ravenports Project. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. [FILE:350:files/Makefile] all: generic autoselect.c: autoselect.c.in sed -e "s|%%SSL_VARIANT%%|${SSL_VARIANT}|" \ -e "s|%%PREFIX%%|${PREFIX}|g" ${.ALLSRC} > ${.TARGET} generic: autoselect.c ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} install: .for prog in openssl c_rehash nc ocspcheck ${BSD_INSTALL_PROGRAM} generic ${DESTDIR}${PREFIX}/bin/${prog} .endfor [FILE:2961:files/autoselect.c.in] /* * This program runs one of the five SSL variants supported by ravenports. * The first priority is the variant specified by SSL_VARIANT environment * variable. The second priority is the SSL default defined by the * ravenadm profile that builds this file. The remaining priority is: * openssl30 * libressl * openssl11 * libressl-devel * openssl10 * * If no SSL variant is installed, an error message will be displayed, * otherwise the requested program will be executed. */ #include #include #include #include int main(int argc, char **argv) { int x; char *override; char *ALPHA = "openssl30"; char *BRAVO = "libressl"; char *CHARLIE = "openssl11"; char *DELTA = "libressl-devel"; char *ECHO = "openssl10"; char *ZULU = "%%SSL_VARIANT%%"; char *sslver = NULL; char *cmd; char recommand[1024]; /* * Get the last path element of the program name being executed */ cmd = strrchr(argv[0], '/'); if (cmd != NULL) cmd++; else cmd = argv[0]; override = getenv("SSL_VARIANT"); if (override != NULL) { if (strcmp (override, ALPHA) == 0) { sslver = ALPHA; } else if (strcmp (override, BRAVO) == 0) { sslver = BRAVO; } else if (strcmp (override, CHARLIE) == 0) { sslver = CHARLIE; } else if (strcmp (override, DELTA) == 0) { sslver = DELTA; } else if (strcmp (override, ECHO) == 0) { sslver = ECHO; } else { printf ("Invalid SSL_VARIANT value: %s\n", override); exit(1); } snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", sslver, cmd); } if (sslver == NULL) { snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", ZULU, cmd); if (access(recommand, F_OK) != -1) { sslver = ZULU; }; } if (sslver == NULL && ZULU != ALPHA) { snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", ALPHA, cmd); if (access(recommand, F_OK) != -1) { sslver = ALPHA; }; } if (sslver == NULL && ZULU != BRAVO) { snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", BRAVO, cmd); if (access(recommand, F_OK) != -1) { sslver = BRAVO; }; } if (sslver == NULL && ZULU != CHARLIE) { snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", CHARLIE, cmd); if (access(recommand, F_OK) != -1) { sslver = CHARLIE; }; } if (sslver == NULL && ZULU != DELTA) { snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", DELTA, cmd); if (access(recommand, F_OK) != -1) { sslver = DELTA; }; } if (sslver == NULL && ZULU != ECHO) { snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s", ECHO, cmd); if (access(recommand, F_OK) != -1) { sslver = ECHO; }; } if (sslver == NULL) { printf ("No version of %s is installed.\n", cmd); exit(1); } argv[0] = recommand; execv(recommand, argv); /* * Execution failed, so write out an error message */ printf ("Command execution failed: %s\n", recommand); printf (" arguments:"); for (x = 1; x < argc; x++) printf (" %s", argv[x]); printf ("\n"); exit (1); }