| 3019 | } |
| 3020 | |
| 3021 | int maybe_add_e_option(char *buf, int buf_len) |
| 3022 | { |
| 3023 | int x = 0; |
| 3024 | |
| 3025 | /* We don't really know the actual protocol_version at this point, |
| 3026 | * but checking the pre-negotiated value allows the user to use a |
| 3027 | * --protocol=29 override to avoid the use of this -eFLAGS opt. */ |
| 3028 | if (protocol_version >= 30 && buf_len > 0) { |
| 3029 | /* We make use of the -e option to let the server know about |
| 3030 | * any pre-release protocol version && some behavior flags. */ |
| 3031 | buf[x++] = 'e'; |
| 3032 | |
| 3033 | #if SUBPROTOCOL_VERSION != 0 |
| 3034 | if (protocol_version == PROTOCOL_VERSION) |
| 3035 | x += snprintf(buf + x, buf_len - x, "%d.%d", PROTOCOL_VERSION, SUBPROTOCOL_VERSION); |
| 3036 | else |
| 3037 | #endif |
| 3038 | buf[x++] = '.'; |
| 3039 | if (allow_inc_recurse) |
| 3040 | buf[x++] = 'i'; |
| 3041 | #ifdef CAN_SET_SYMLINK_TIMES |
| 3042 | buf[x++] = 'L'; /* symlink time-setting support */ |
| 3043 | #endif |
| 3044 | #ifdef ICONV_OPTION |
| 3045 | buf[x++] = 's'; /* symlink iconv translation support */ |
| 3046 | #endif |
| 3047 | buf[x++] = 'f'; /* flist I/O-error safety support */ |
| 3048 | buf[x++] = 'x'; /* xattr hardlink optimization not desired */ |
| 3049 | buf[x++] = 'C'; /* support checksum seed order fix */ |
| 3050 | buf[x++] = 'I'; /* support inplace_partial behavior */ |
| 3051 | buf[x++] = 'v'; /* use varint for flist & compat flags; negotiate checksum */ |
| 3052 | buf[x++] = 'u'; /* include name of uid 0 & gid 0 in the id map */ |
| 3053 | |
| 3054 | /* NOTE: Avoid using 'V' -- it was represented with the high bit of a write_byte() that became a write_varint(). */ |
| 3055 | } |
| 3056 | |
| 3057 | if (x >= buf_len) { /* Not possible... */ |
| 3058 | rprintf(FERROR, "overflow in add_e_flags().\n"); |
| 3059 | exit_cleanup(RERR_MALLOC); |
| 3060 | } |
| 3061 | |
| 3062 | buf[x] = '\0'; |
| 3063 | |
| 3064 | return x; |
| 3065 | } |
| 3066 | |
| 3067 | /* If str points to a valid hostspec, return allocated memory containing the |
| 3068 | * [USER@]HOST part of the string, and set the path_start_ptr to the part of |
no test coverage detected