search for: c_isalnum

Displaying 20 results from an estimated 22 matches for "c_isalnum".

2006 Oct 30
1
QueryParser and prefixes
Hi all, My app uses prefixes for user-defined labels and directory names. Since these are case-sensitive, I chose XLABEL and XDIR respectively. Labels and directories may start with an upper-case, so a ":" is always inserted between the prefix and the term itself. These prefixes are mapped with add_boolean_prefix to "dir" and "label". Let's imagine I index a
2020 Mar 30
6
[PATCH common 0/4] options: Support Windows BitLocker (RHBZ#1808977).
Support transparent decryption/inspection of Windows guests encrypted with BitLocker encryption. This won't make much sense without the associated libguestfs patches which I will post momentarily. (Submodules, ho hum) Rich.
2016 Dec 22
1
Re: [PATCH 2/2] launch: Validate $TERM before passing it through to the kernel command line.
...*/ > +static int > +valid_term (const char *term) I guess the return value can be bool. > +{ > + size_t len = strlen (term); > + > + if (len == 0 || len > 16) > + return 0; > + > + while (len > 0) { > + char c = *term++; > + len--; > + if (!c_isalnum (c) && c != '-' && c != '_') > + return 0; > + } The loop is fine already, maybe the need to use len can be dropped: for (; *term; ++term) { char c = *term; if (!c_isalnum (c) && c != '-' && c != '_') retu...
2020 Mar 30
0
[PATCH common 2/4] options: Generate cryptsetup mapnames beginning with "crypt..." not "luks..."
...ice) { size_t i = 0; - - if (len < 5) - abort (); - strcpy (mapname, "luks"); - mapname += 4; - len -= 4; + char *ret; if (STRPREFIX (device, "/dev/")) - i = 5; + device += 5; - for (; device[i] != '\0' && len >= 1; ++i) { - if (c_isalnum (device[i])) { - *mapname++ = device[i]; - len--; - } + if (asprintf (&ret, "crypt%s", &device[i]) == -1) + error (EXIT_FAILURE, errno, "asprintf"); + + for (i = 5; i < strlen (ret); ++i) { + if (!c_isalnum (ret[i])) + memmove (&ret[i], &...
2016 Dec 18
3
[PATCH 1/2] launch: Rationalize how we construct the Linux kernel command line.
This is just code refactoring. --- src/launch.c | 172 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 109 insertions(+), 63 deletions(-) diff --git a/src/launch.c b/src/launch.c index 46d7ab9..84d5e82 100644 --- a/src/launch.c +++ b/src/launch.c @@ -293,9 +293,7 @@ guestfs_impl_config (guestfs_h *g, #endif #if defined(__aarch64__) -#define EARLYPRINTK "
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
...the $TERM environment variable is reasonable before * we pass it through to the appliance. */ -static bool -valid_term (const char *term) -{ - size_t len = strlen (term); - - if (len == 0 || len > 16) - return false; - - while (len > 0) { - char c = *term++; - len--; - if (!c_isalnum (c) && c != '-' && c != '_') - return false; - } - - return true; -} +#define VALID_TERM(term) \ + guestfs_int_string_is_valid ((term), 1, 16, true, true, "-_") #if defined(__powerpc64__) #define SERIAL_CONSOLE "console=hvc0 console=ttyS0&q...
2016 Dec 24
2
[PATCH] lib: Use a common function to validate strings.
As discussed in the thread on validating $TERM, it would be good to have a common function to do this. This is such a function. The main advantage is it includes unit tests which the previous functions did not. Rich.
2016 Sep 19
0
[PATCH 1/3] fish: move disk decryption helpers in own file
...*device, char *mapname, size_t len) +{ + size_t i = 0; + + if (len < 5) + abort (); + strcpy (mapname, "luks"); + mapname += 4; + len -= 4; + + if (STRPREFIX (device, "/dev/")) + i = 5; + + for (; device[i] != '\0' && len >= 1; ++i) { + if (c_isalnum (device[i])) { + *mapname++ = device[i]; + len--; + } + } + + *mapname = '\0'; +} + +/** + * Simple implementation of decryption: look for any C<crypto_LUKS> + * partitions and decrypt them, then rescan for VGs. This only works + * for Fedora whole-disk encryption. WI...
2016 Dec 18
0
[PATCH 2/2] launch: Validate $TERM before passing it through to the kernel command line.
...that the $TERM environment variable is reasonable before + * we pass it through to the appliance. + */ +static int +valid_term (const char *term) +{ + size_t len = strlen (term); + + if (len == 0 || len > 16) + return 0; + + while (len > 0) { + char c = *term++; + len--; + if (!c_isalnum (c) && c != '-' && c != '_') + return 0; + } + + return 1; +} + #if defined(__powerpc64__) #define SERIAL_CONSOLE "console=hvc0 console=ttyS0" #elif defined(__arm__) || defined(__aarch64__) @@ -425,7 +449,7 @@ guestfs_int_appliance_command_line (g...
2010 Apr 03
1
hivex: Exported foreign symbols in libhivex.so.0.0.0
...n the Debian package to aid the package maintainer automatically detect future changes shows internal library and helper function names, whereas it should only be exporting hivex_* function names. This page may help with this: http://gcc.gnu.org/wiki/Visibility Symbols: asnprintf at Base 1.2.1 c_isalnum at Base 1.2.1 c_isalpha at Base 1.2.1 c_isascii at Base 1.2.1 c_isblank at Base 1.2.1 c_iscntrl at Base 1.2.1 c_isdigit at Base 1.2.1 c_isgraph at Base 1.2.1 c_islower at Base 1.2.1 c_isprint at Base 1.2.1 c_ispunct at Base 1.2.1 c_isspace at Base 1.2.1 c_isupper at Base 1.2.1 c_isxdigi...
2005 Dec 09
1
QueryParser and utf-8 strings
...teration in accentnormalisingitor.h and modified common/utils.h to contain: inline bool C_isalpha(char ch) { using namespace Xapian::Internal; return (static_cast<unsigned char>(ch)>=0x80) || (is_tab[static_cast<unsigned char>(ch)] & (IS_UPPER|IS_LOWER)); } inline bool C_isalnum(char ch) { using namespace Xapian::Internal; return (static_cast<unsigned char>(ch)>=0x80) || (is_tab[static_cast<unsigned char>(ch)] & (IS_UPPER|IS_LOWER|IS_DIGIT)); } since most of the characters above 0x80 are meant as letters, only with very few exceptions (non brea...
2010 May 12
1
[PATCH] guestfish -i and virt-inspector work on filenames containing spaces (RHBZ#507810).
...rror (cmd2); exit (EXIT_FAILURE); } + + free (cmd); + free (cmd2); + free (insp); + exit (WEXITSTATUS (r)); } @@ -1616,3 +1660,22 @@ file_out (const char *arg) } return ret; } + +static int +print_shell_quote (FILE *stream, const char *str) +{ +#define SAFE(c) (c_isalnum((c)) || \ + (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.') + int i, len; + + for (i = len = 0; str[i]; ++i) { + if (!SAFE(str[i])) { + putc ('\\', stream); + len ++; + } + putc (str[i], stream); + len ++; +...
2016 Sep 19
6
[PATCH 0/3] add crypto/LUKS support in some OCaml-based tools
Hi, this series refactors some guestfish code (not much), and exposes it via Common_utils, so it is possible to decrypt LUKS partitions when using virt-customize, virt-get-kernel, virt-sparsify, and virt-sysprep. This brings them closer in features with C tools. Most probably a couple more of other OCaml-based tools (virt-v2v to convert encrypted guests, and virt-builder to use encrypted
2015 Oct 07
2
[PATCH 0/2] New APIs: set-identifier, get-identifier
This is very useful for debugging multithreaded programs. Rich.
2012 Aug 06
1
[PATCH V2] virt-diff: add new virt-diff tool
...*device, char *mapname, size_t len) +{ + size_t i = 0; + + if (len < 5) + abort (); + strcpy (mapname, "luks"); + mapname += 4; + len -= 4; + + if (STRPREFIX (device, "/dev/")) + i = 5; + + for (; device[i] != '\0' && len >= 1; ++i) { + if (c_isalnum (device[i])) { + *mapname++ = device[i]; + len--; + } + } + + *mapname = '\0'; +} + +static void +free_strings (char **strings) +{ + size_t i; + + for (i = 0; strings[i] != NULL; ++i) + free (strings[i]); + free (strings); +} + +static size_t +count_strings (char **stri...
2018 Feb 15
0
[PATCH] Introduce a wrapper around xmlParseURI.
...ht be rewritten as ‘%XX’). + */ + len = strlen (uri); + escaped_uri = malloc (3*len + 1); + if (escaped_uri == NULL) + return NULL; + + for (i = j = 0; i < strlen (uri); ++i) { + /* See RFC 3986 appendix A. Note this leaves existing %-encoded + * escapes alone. + */ + if (c_isalnum (uri[i]) || + strchr ("%-._~:/?#[]@!$&'()*+,;=", uri[i]) != NULL) + escaped_uri[j++] = uri[i]; + else { + escaped_uri[j++] = '%'; + escaped_uri[j++] = hexdigit [(((unsigned char) uri[i]) >> 4) & 0xf]; + escaped_uri[j++] = hexdigit [(...
2018 Nov 02
0
[PATCH REPOST] Introduce a wrapper around xmlParseURI.
...ht be rewritten as ‘%XX’). + */ + len = strlen (uri); + escaped_uri = malloc (3*len + 1); + if (escaped_uri == NULL) + return NULL; + + for (i = j = 0; i < strlen (uri); ++i) { + /* See RFC 3986 appendix A. Note this leaves existing %-encoded + * escapes alone. + */ + if (c_isalnum (uri[i]) || + strchr ("%-._~:/?#[]@!$&'()*+,;=", uri[i]) != NULL) + escaped_uri[j++] = uri[i]; + else { + escaped_uri[j++] = '%'; + escaped_uri[j++] = hexdigit [(((unsigned char) uri[i]) >> 4) & 0xf]; + escaped_uri[j++] = hexdigit [(...
2017 Dec 12
1
[PATCH] Introduce a wrapper around xmlParseURI.
An alternate solution to: https://www.redhat.com/archives/libguestfs/2017-December/msg00035.html "[PATCH] v2v: -i vmx: Allow ssh URLs to use spaces." is to classify all URLs processed by libguestfs as either ordinary URLs or the special non-standard URLs that we use for things like ‘virt-v2v -i vmx’ and ‘guestfish --add’. For the non-standard URLs, provide a wrapper around
2009 Sep 24
1
enabling more syntax-checks
...uot; #include "daemon.h" static char *read_cmdline (void); @@ -835,7 +835,7 @@ print_shell_quote (FILE *stream, const struct printf_info *info ATTRIBUTE_UNUSED, const void *const *args) { -#define SAFE(c) (isalnum((c)) || \ +#define SAFE(c) (c_isalnum((c)) || \ (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.') int i, len; const char *str = *((const char **) (args[0])); diff --git a/daemon/lvm.c b/daemon/lvm.c index 742b40b..9865bb2 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -22...
2018 Nov 02
2
[PATCH REPOST] Introduce a wrapper around xmlParseURI.
Previously posted: https://www.redhat.com/archives/libguestfs/2017-December/msg00046.html Rich.