- 01 Jan, 2011 9 commits
-
-
Moe Jette authored
hostlist_deranged_string(): test for overflow This builds upon the preceding patch, exploiting that hostrange_to_string() * returns >= 0 when it has terminated the string with '\0', where either - n == 0 and it has not written anything or - it has written at most n > 0 characters, indicated by returning n-1 >= 0; * returns a negative value to indicate truncation. Hence hostrange_deranged_string() changed as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * added 'len < n' as loop condition, to catch the case 'n == 0' (also exploiting that NUL-termination is only needed on error); * separator now is inserted after all non-first elements (to avoid having to undo the last separator); * as in preceding patch, replaced 'truncated' variable by a jump label.
-
Moe Jette authored
hostrange_to_string(): truncation checks * turned 'truncated' variable into jump label; * loop changes so that the pre-condition is always len < n: - if len >= n inside the loop, the a jump to 'truncated' follows, - hence loop post-condition is also len < n, so that buf[len] = '\0' works; * consistently check ret=snprintf() for "ret < 0 || (len += ret) >= n", - if dims > 1, also tests to ensure that len + dims < n, - further overflow test after incrementing len for separator; * moved separator test up (inserted when i > hr->lo) (to avoid having to undo the last separator).
-
Moe Jette authored
hostrange_pop()/hostrange_shift(): test for overflow hostrange_pop(): * retrofitted out_of_memory() test after strdup; * tested for negative length/overflow before the while-loop, making sure that 'dims' characters also fit in; * second snprintf is not tested. hostrange_shift(): * analogous changes (second snprintf also not tested).
-
Moe Jette authored
host_prefix_end(): save variable, factor out common expressions This saves one variable and factors out the condition common to the if/else branches.06_hostlist__host_prefix_end.diff * return type of strlen is unsigned (size_t), hence strlen(hostname) >= 0; * both while-loops require idx >= 0, hence -1 is returned if strlen(hostname) == 0.
-
Moe Jette authored
_get_bracketed_list(): simplify and look for overflow conditions * initial test requires that len + 4 < n, - this ensures enough space for '[', ']', one digit and '\0', - simplifies many subsequent tests (e.g. for bracket_needed); * loop has been reorganized: - pre-condition: len + 3 < n - loop run-condition: len < n-1 - post-condition: len < n-1 (otherwise, it returns n); * therefore len < n after adding ']' * and thus len < n when calling buf[len] = '\0'.
-
Moe Jette authored
hostrange_numstr(): overflow cases This checks hostrange_numstr() for overflow cases: * requires n > dims (if dims=1, min 1 digit, else dim + '\0' digits); - this precondition simplifies many subsequent checks and - addresses if (len == n) then len++ means buf[len] = buf[n]; * also checks return value of the snprintfs.
-
Moe Jette authored
_hostrange_string()/hostlist_next(): test for overrun This lets the two functions _hostrange_string/hostlist_next return NULL in case there is an overflow condition. Two possible overflow conditions were analyzed: * if len <= MAXHOSTNAMELEN + 15 and the '=' is the case, then len++ means that buf[len] = '\0' is the same as buf[MAXHOSTNAMELEN + 16], which would cause a segmentation violation - fixed by checking length beforehand; * also checks the return value of the snprintfs, * and requires 'dims' as minimum suffix length.
-
Moe Jette authored
hostlist: let hostlist_get_base() depend on current dimensions This patch saves one call to slurmdb_setup_cluster_dims(): exploiting that the dimensions for which hostlist_get_base() is called are known in all contexts in which the function is used.
-
Moe Jette authored
hostlist: shorter conversion This replaces the hostlist_parse_int_to_array() routine with a simpler and equivalent routine. I was wondering what the algorithm does, when suddenly the flow became simpler. Problem: we want to create an array 'out' of 'dims' dimensions where out[i], 0 <= i < dims, has the coefficients a_j of the polynomial a_(dims-1) * B^(dims-1) + ... + a_1 * B + a_0 where B is the base of the polynomial 'in' and a_0 = out[dims - 1] a_1 = out[dims - 2] ... a_(dims-1) = a[0] Using the Horner Scheme, 'in' is represented as * dims = 1: a_0 = out[0] * dims = 2: a_1 * B + a_0 = out[0] * B + out[1] * dims = 3: (a_2 * B + a_1) * B + a_0 * dims = 4: ((a_3 * B + a_2) * B + a_1) * B + a_0 ... * dims = n: ((a_(n-1) * B + a_(n-2)) * B ... + a_1) * B + a_0 We can get a_0 = out[dims-1] as "in % B" and then derive a_1, a_2, ... by first dividing by B, and then repeating the process. If in is 0, all 'dims' coefficients are 0, if it is negative, all coefficients are negative.
-
- 29 Dec, 2010 4 commits
-
-
Danny Auble authored
Added that when a slurmctld closes the connection to the database it's registered host and port are removed.
-
Danny Auble authored
added semi-support for cgywin systems. The slurmctld doesn't work becuase it exports symbols to the dll's and dll' s can't import things like that. But things should compile correctly and user tools like sview appear to work corr ectly.
-
Danny Auble authored
-
Danny Auble authored
-
- 28 Dec, 2010 15 commits
-
-
Moe Jette authored
-
Don Lipari authored
-
Moe Jette authored
-
Don Lipari authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Don Lipari authored
-
Moe Jette authored
-
Danny Auble authored
-
Danny Auble authored
OK, this will probably where this part of the project stops since I can't figure out how to have the dll's in windo ws grab the symbols from the slurmctld (like part_list). It just uses the private value which isn't what we want. Things like sview and such work fine though. (In cygwin the slurmd gets the name in all uppercase so you have to define it that way)
-
- 27 Dec, 2010 10 commits
-
-
Danny Auble authored
-
Don Lipari authored
-
Don Lipari authored
-
Don Lipari authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Danny Auble authored
-
Moe Jette authored
-
- 22 Dec, 2010 2 commits
-
-
Danny Auble authored
-
Danny Auble authored
-