Merge ~joalif/ubuntu/+source/cifs-utils:lp1886551-focal into ubuntu/+source/cifs-utils:ubuntu/focal-devel
- Git
- lp:~joalif/ubuntu/+source/cifs-utils
- lp1886551-focal
- Merge into ubuntu/focal-devel
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Andreas Hasenack | ||||
| Approved revision: | 5bf18abca871698f384a3cbb3d5460fb0d8af010 | ||||
| Merged at revision: | 5bf18abca871698f384a3cbb3d5460fb0d8af010 | ||||
| Proposed branch: | ~joalif/ubuntu/+source/cifs-utils:lp1886551-focal | ||||
| Merge into: | ubuntu/+source/cifs-utils:ubuntu/focal-devel | ||||
| Diff against target: |
527 lines (+483/-0) 7 files modified
debian/changelog (+11/-0) debian/patches/0002-smbinfo-Improve-help-usage-and-add-h-option.patch (+108/-0) debian/patches/0003-smbinfo-add-GETCOMPRESSION-support.patch (+102/-0) debian/patches/0004-smbinfo-print-the-security-information-needed-to-dec.patch (+108/-0) debian/patches/0005-smbinfo-Add-SETCOMPRESSION-support.patch (+119/-0) debian/patches/0006-smbinfo.rst-document-new-keys-command.patch (+30/-0) debian/patches/series (+5/-0) |
||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Andreas Hasenack | Approve | ||
|
Review via email:
|
|||
Commit message
Description of the change
| Andreas Hasenack (ahasenack) wrote : | # |
The rest is +1. I suggest to update the "[other info]" section in the sru bug to explain why you chose to also add other changes not strictly related to "smbinfo keys" support. I would say that it's a standalone utility, and backporting just the exactly required patches could introduce the risk of adding bugs in the process. For the case of focal, adding the compression commands is to keep it in parity with that is being introduced in bionic. But the SRU team might object to this approach and request that only the "keys" command be backported in both ubuntu releases.
| Andreas Hasenack (ahasenack) wrote : | # |
I forgot to ask to run update-maintainer, to update d/control. I'm doing that and pushing with my change.
| Andreas Hasenack (ahasenack) wrote : | # |
Tagging and uploading a4a3b86d0ac5999
commit a4a3b86d0ac5999
Author: Andreas Hasenack <email address hidden>
Date: Mon Sep 14 17:43:48 2020 -0300
update-metadata
diff --git a/debian/control b/debian/control
index 37f6ebc..0a46b22 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,8 @@
Source: cifs-utils
Section: otherosfs
Priority: optional
-Maintainer: Debian Samba Maintainers <email address hidden>
+Maintainer: Ubuntu Developers <email address hidden>
+XSBC-Original-
Uploaders: Steve Langasek <email address hidden>, Noèl Köthe <email address hidden>, Jelmer Vernooij <email address hidden>, Mathieu Parent <email address hidden>
Build-Depends:
commit 5bf18abca871698
Author: Ioanna Alifieraki <email address hidden>
Date: Mon Sep 14 14:41:36 2020 +0100
debian/
....
...
$ git push pkg upload/
Enumerating objects: 49, done.
Counting objects: 100% (49/49), done.
Delta compression using up to 4 threads
Compressing objects: 100% (42/42), done.
Writing objects: 100% (43/43), 9.14 KiB | 2.29 MiB/s, done.
Total 43 (delta 28), reused 5 (delta 1)
To ssh://git.
* [new tag] upload/
$ dput ubuntu ../cifs-
Checking signature on .changes
gpg: ../cifs-
Checking signature on .dsc
gpg: ../cifs-
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading cifs-utils_
Uploading cifs-utils_
Uploading cifs-utils_
Uploading cifs-utils_
Successfully uploaded packages.
Preview Diff
| 1 | diff --git a/debian/changelog b/debian/changelog |
| 2 | index 97ac746..bf9b606 100644 |
| 3 | --- a/debian/changelog |
| 4 | +++ b/debian/changelog |
| 5 | @@ -1,3 +1,14 @@ |
| 6 | +cifs-utils (2:6.9-1ubuntu0.1) focal; urgency=medium |
| 7 | + |
| 8 | + * Add 'keys' command to smbinfo (LP: #1886551): |
| 9 | + - d/p/0002-smbinfo-Improve-help-usage-and-add-h-option.patch |
| 10 | + - d/p/0003-smbinfo-add-GETCOMPRESSION-support.patch |
| 11 | + - d/p/0004-smbinfo-print-the-security-information-needed-to-dec.patch |
| 12 | + - d/p/0005-smbinfo-Add-SETCOMPRESSION-support.patch |
| 13 | + - d/p/0006-smbinfo.rst-document-new-keys-command.patch |
| 14 | + |
| 15 | + -- Ioanna Alifieraki <ioanna-maria.alifieraki@canonical.com> Mon, 14 Sep 2020 12:55:41 +0100 |
| 16 | + |
| 17 | cifs-utils (2:6.9-1) unstable; urgency=medium |
| 18 | |
| 19 | [ Jelmer Vernooij ] |
| 20 | diff --git a/debian/patches/0002-smbinfo-Improve-help-usage-and-add-h-option.patch b/debian/patches/0002-smbinfo-Improve-help-usage-and-add-h-option.patch |
| 21 | new file mode 100644 |
| 22 | index 0000000..0d5231c |
| 23 | --- /dev/null |
| 24 | +++ b/debian/patches/0002-smbinfo-Improve-help-usage-and-add-h-option.patch |
| 25 | @@ -0,0 +1,108 @@ |
| 26 | +From 12c2f088fa3d666fc5aa48a700e740523d8d2023 Mon Sep 17 00:00:00 2001 |
| 27 | +From: Kenneth D'souza <kdsouza@redhat.com> |
| 28 | +Origin: Upstream, https://git.samba.org/?p=cifs-utils.git;a=commit;h=12c2f088fa3d666fc5aa48a700e740523d8d2023 |
| 29 | +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1886551 |
| 30 | +Date: Wed, 17 Apr 2019 15:36:46 +0530 |
| 31 | +Subject: [PATCH] smbinfo: Improve help usage and add -h option. |
| 32 | + |
| 33 | +Call usage only for -h case. This avoids cluttering the screen with long |
| 34 | +help output. |
| 35 | +As we are adding more options to the utility, the end error is just hidden. |
| 36 | +Call short_usage wherever necessary. |
| 37 | + |
| 38 | +Signed-off-by: Kenneth D'souza <kdsouza@redhat.com> |
| 39 | +--- |
| 40 | + smbinfo.c | 27 ++++++++++++++++++++++----- |
| 41 | + smbinfo.rst | 5 ++++- |
| 42 | + 2 files changed, 26 insertions(+), 6 deletions(-) |
| 43 | + |
| 44 | +diff --git a/smbinfo.c b/smbinfo.c |
| 45 | +index 4bc503a..6e258c2 100644 |
| 46 | +--- a/smbinfo.c |
| 47 | ++++ b/smbinfo.c |
| 48 | +@@ -64,6 +64,8 @@ usage(char *name) |
| 49 | + { |
| 50 | + fprintf(stderr, "Usage: %s [-V] <command> <file>\n" |
| 51 | + "-V for verbose output\n" |
| 52 | ++ "-h display this help text\n" |
| 53 | ++ "-v print smbinfo version\n" |
| 54 | + "Commands are\n" |
| 55 | + " fileaccessinfo:\n" |
| 56 | + " Prints FileAccessInfo for a cifs file.\n" |
| 57 | +@@ -97,6 +99,14 @@ usage(char *name) |
| 58 | + exit(1); |
| 59 | + } |
| 60 | + |
| 61 | ++static void |
| 62 | ++short_usage(char *name) |
| 63 | ++{ |
| 64 | ++ fprintf(stderr, "Usage: %s [-v] [-V] <command> <file>\n" |
| 65 | ++ "Try 'smbinfo -h' for more information.\n", name); |
| 66 | ++ exit(1); |
| 67 | ++} |
| 68 | ++ |
| 69 | + static void |
| 70 | + win_to_timeval(uint64_t smb2_time, struct timeval *tv) |
| 71 | + { |
| 72 | +@@ -1075,7 +1085,11 @@ int main(int argc, char *argv[]) |
| 73 | + int c; |
| 74 | + int f; |
| 75 | + |
| 76 | +- while ((c = getopt_long(argc, argv, "vV", NULL, NULL)) != -1) { |
| 77 | ++ if (argc < 2) { |
| 78 | ++ short_usage(argv[0]); |
| 79 | ++ } |
| 80 | ++ |
| 81 | ++ while ((c = getopt_long(argc, argv, "vVh", NULL, NULL)) != -1) { |
| 82 | + switch (c) { |
| 83 | + case 'v': |
| 84 | + printf("smbinfo version %s\n", VERSION); |
| 85 | +@@ -1083,15 +1097,18 @@ int main(int argc, char *argv[]) |
| 86 | + case 'V': |
| 87 | + verbose = 1; |
| 88 | + break; |
| 89 | +- default: |
| 90 | ++ case 'h': |
| 91 | + usage(argv[0]); |
| 92 | ++ break; |
| 93 | ++ default: |
| 94 | ++ short_usage(argv[0]); |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | +- if (optind >= argc - 1) |
| 99 | +- usage(argv[0]); |
| 100 | ++ if (optind >= argc -1) |
| 101 | ++ short_usage(argv[0]); |
| 102 | + |
| 103 | +- if ((f = open(argv[optind + 1], O_RDONLY)) < 0) { |
| 104 | ++ if ((f = open(argv[optind + 1 ], O_RDONLY)) < 0) { |
| 105 | + fprintf(stderr, "Failed to open %s\n", argv[optind + 1]); |
| 106 | + exit(1); |
| 107 | + } |
| 108 | +diff --git a/smbinfo.rst b/smbinfo.rst |
| 109 | +index 0c96050..be4c829 100644 |
| 110 | +--- a/smbinfo.rst |
| 111 | ++++ b/smbinfo.rst |
| 112 | +@@ -11,7 +11,7 @@ Userspace helper to display SMB-specific file information for the Linux SMB clie |
| 113 | + SYNOPSIS |
| 114 | + ******** |
| 115 | + |
| 116 | +- smbinfo [-v] [-V] {command} {file system object} |
| 117 | ++ smbinfo [-v] [-h] [-V] {command} {file system object} |
| 118 | + |
| 119 | + *********** |
| 120 | + DESCRIPTION |
| 121 | +@@ -38,6 +38,9 @@ OPTIONS |
| 122 | + -V |
| 123 | + Verbose output. |
| 124 | + |
| 125 | ++-h |
| 126 | ++ Print help explaining the command line options. |
| 127 | ++ |
| 128 | + ******* |
| 129 | + COMMAND |
| 130 | + ******* |
| 131 | +-- |
| 132 | +2.17.1 |
| 133 | + |
| 134 | diff --git a/debian/patches/0003-smbinfo-add-GETCOMPRESSION-support.patch b/debian/patches/0003-smbinfo-add-GETCOMPRESSION-support.patch |
| 135 | new file mode 100644 |
| 136 | index 0000000..e16aba5 |
| 137 | --- /dev/null |
| 138 | +++ b/debian/patches/0003-smbinfo-add-GETCOMPRESSION-support.patch |
| 139 | @@ -0,0 +1,102 @@ |
| 140 | +From 1e4fca25948d52fc29410963663f3af72275bcb6 Mon Sep 17 00:00:00 2001 |
| 141 | +From: Ronnie Sahlberg <lsahlber@redhat.com> |
| 142 | +Origin: Upstream, https://git.samba.org/?p=cifs-utils.git;a=commit;h=1e4fca25948d52fc29410963663f3af72275bcb6 |
| 143 | +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1886551 |
| 144 | +Date: Thu, 11 Apr 2019 12:23:06 +1000 |
| 145 | +Subject: [PATCH] smbinfo: add GETCOMPRESSION support |
| 146 | + |
| 147 | +Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> |
| 148 | +--- |
| 149 | + smbinfo.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ |
| 150 | + smbinfo.rst | 2 ++ |
| 151 | + 2 files changed, 50 insertions(+) |
| 152 | + |
| 153 | +diff --git a/smbinfo.c b/smbinfo.c |
| 154 | +index 6e258c2..b4d497b 100644 |
| 155 | +--- a/smbinfo.c |
| 156 | ++++ b/smbinfo.c |
| 157 | +@@ -89,6 +89,8 @@ usage(char *name) |
| 158 | + " Prints FileStandardInfo for a cifs file.\n" |
| 159 | + " fsctl-getobjid:\n" |
| 160 | + " Prints the objectid of the file and GUID of the underlying volume.\n" |
| 161 | ++ " getcompression:\n" |
| 162 | ++ " Prints the compression setting for the file.\n" |
| 163 | + " list-snapshots:\n" |
| 164 | + " List the previous versions of the volume that backs this file.\n" |
| 165 | + " quota:\n" |
| 166 | +@@ -252,6 +254,50 @@ fsctlgetobjid(int f) |
| 167 | + free(qi); |
| 168 | + } |
| 169 | + |
| 170 | ++static void |
| 171 | ++print_getcompression(uint8_t *sd) |
| 172 | ++{ |
| 173 | ++ uint16_t u16; |
| 174 | ++ |
| 175 | ++ memcpy(&u16, &sd[0], 2); |
| 176 | ++ u16 = le16toh(u16); |
| 177 | ++ |
| 178 | ++ printf("Compression: "); |
| 179 | ++ switch (u16) { |
| 180 | ++ case 0: |
| 181 | ++ printf("(0) NONE\n"); |
| 182 | ++ break; |
| 183 | ++ case 2: |
| 184 | ++ printf("(2) LZNT1\n"); |
| 185 | ++ break; |
| 186 | ++ default: |
| 187 | ++ printf("(%d) UNKNOWN\n", u16); |
| 188 | ++ break; |
| 189 | ++ } |
| 190 | ++} |
| 191 | ++ |
| 192 | ++static void |
| 193 | ++getcompression(int f) |
| 194 | ++{ |
| 195 | ++ struct smb_query_info *qi; |
| 196 | ++ |
| 197 | ++ qi = malloc(sizeof(struct smb_query_info) + 2); |
| 198 | ++ memset(qi, 0, sizeof(qi) + 2); |
| 199 | ++ qi->info_type = 0x9003c; |
| 200 | ++ qi->file_info_class = 0; |
| 201 | ++ qi->additional_information = 0; |
| 202 | ++ qi->input_buffer_length = 2; |
| 203 | ++ qi->flags = PASSTHRU_FSCTL; |
| 204 | ++ |
| 205 | ++ if (ioctl(f, CIFS_QUERY_INFO, qi) < 0) { |
| 206 | ++ fprintf(stderr, "ioctl failed with %s\n", strerror(errno)); |
| 207 | ++ exit(1); |
| 208 | ++ } |
| 209 | ++ print_getcompression((uint8_t *)(&qi[1])); |
| 210 | ++ |
| 211 | ++ free(qi); |
| 212 | ++} |
| 213 | ++ |
| 214 | + static void |
| 215 | + print_fileaccessinfo(uint8_t *sd, int type) |
| 216 | + { |
| 217 | +@@ -1135,6 +1181,8 @@ int main(int argc, char *argv[]) |
| 218 | + filestandardinfo(f); |
| 219 | + else if (!strcmp(argv[optind], "fsctl-getobjid")) |
| 220 | + fsctlgetobjid(f); |
| 221 | ++ else if (!strcmp(argv[optind], "getcompression")) |
| 222 | ++ getcompression(f); |
| 223 | + else if (!strcmp(argv[optind], "list-snapshots")) |
| 224 | + list_snapshots(f); |
| 225 | + else if (!strcmp(argv[optind], "quota")) |
| 226 | +diff --git a/smbinfo.rst b/smbinfo.rst |
| 227 | +index be4c829..500ce0e 100644 |
| 228 | +--- a/smbinfo.rst |
| 229 | ++++ b/smbinfo.rst |
| 230 | +@@ -67,6 +67,8 @@ COMMAND |
| 231 | + |
| 232 | + `fsctl-getobjid`: Prints the ObjectID |
| 233 | + |
| 234 | ++`getcompression`: Prints the compression setting for the file. |
| 235 | ++ |
| 236 | + `list-snapshots`: Lists the previous versions of the volume that backs this file |
| 237 | + |
| 238 | + `quota`: Print the quota for the volume in the form |
| 239 | +-- |
| 240 | +2.17.1 |
| 241 | + |
| 242 | diff --git a/debian/patches/0004-smbinfo-print-the-security-information-needed-to-dec.patch b/debian/patches/0004-smbinfo-print-the-security-information-needed-to-dec.patch |
| 243 | new file mode 100644 |
| 244 | index 0000000..909cf22 |
| 245 | --- /dev/null |
| 246 | +++ b/debian/patches/0004-smbinfo-print-the-security-information-needed-to-dec.patch |
| 247 | @@ -0,0 +1,108 @@ |
| 248 | +From 6df98da5cd3fbb33f6f535c6784f037bbadadb84 Mon Sep 17 00:00:00 2001 |
| 249 | +From: Steve French <stfrench@microsoft.com> |
| 250 | +Origin: Upstream, https://git.samba.org/?p=cifs-utils.git;a=commit;h=6df98da5cd3fbb33f6f535c6784f037bbadadb84 |
| 251 | +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1886551 |
| 252 | +Date: Thu, 19 Sep 2019 04:21:16 -0500 |
| 253 | +Subject: [PATCH] smbinfo: print the security information needed to decrypt |
| 254 | + wireshark trace |
| 255 | + |
| 256 | +CCM encryption |
| 257 | +Session Id: e2 3e ea ae 00 00 00 00 |
| 258 | +Session Key: 65 7e 0e d5 3c 06 5a 06 50 a3 ef 96 c1 64 3d 1f |
| 259 | +Server Encryption Key: 5e 42 a7 b5 57 75 d6 56 4a 5d 33 97 e6 45 07 76 |
| 260 | +Server Decryption Key: 1f 64 db a3 0f 24 e3 4d b6 31 00 ab 9a af 22 47 |
| 261 | + |
| 262 | +Signed-off-by: Steve French <stfrench@microsoft.com> |
| 263 | +--- |
| 264 | + smbinfo.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- |
| 265 | + 1 file changed, 52 insertions(+), 1 deletion(-) |
| 266 | + |
| 267 | +diff --git a/smbinfo.c b/smbinfo.c |
| 268 | +index b4d497b..2aa5eee 100644 |
| 269 | +--- a/smbinfo.c |
| 270 | ++++ b/smbinfo.c |
| 271 | +@@ -54,7 +54,17 @@ struct smb_query_info { |
| 272 | + /* char buffer[]; */ |
| 273 | + } __packed; |
| 274 | + |
| 275 | ++#define SMB3_SIGN_KEY_SIZE 16 |
| 276 | ++struct smb3_key_debug_info { |
| 277 | ++ uint64_t Suid; |
| 278 | ++ uint16_t cipher_type; |
| 279 | ++ uint8_t auth_key[16]; /* SMB2_NTLMV2_SESSKEY_SIZE */ |
| 280 | ++ uint8_t smb3encryptionkey[SMB3_SIGN_KEY_SIZE]; |
| 281 | ++ uint8_t smb3decryptionkey[SMB3_SIGN_KEY_SIZE]; |
| 282 | ++} __attribute__((packed)); |
| 283 | ++ |
| 284 | + #define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info) |
| 285 | ++#define CIFS_DUMP_KEY _IOWR(CIFS_IOCTL_MAGIC, 8, struct smb3_key_debug_info) |
| 286 | + #define INPUT_BUFFER_LENGTH 16384 |
| 287 | + |
| 288 | + int verbose; |
| 289 | +@@ -96,7 +106,9 @@ usage(char *name) |
| 290 | + " quota:\n" |
| 291 | + " Prints the quota for a cifs file.\n" |
| 292 | + " secdesc:\n" |
| 293 | +- " Prints the security descriptor for a cifs file.\n", |
| 294 | ++ " Prints the security descriptor for a cifs file.\n" |
| 295 | ++ " keys:\n" |
| 296 | ++ " Prints the decryption information needed to view encrypted network traces.\n", |
| 297 | + name); |
| 298 | + exit(1); |
| 299 | + } |
| 300 | +@@ -1071,6 +1083,43 @@ static void print_snapshots(struct smb_snapshot_array *psnap) |
| 301 | + printf("\n"); |
| 302 | + } |
| 303 | + |
| 304 | ++static void |
| 305 | ++dump_keys(int f) |
| 306 | ++{ |
| 307 | ++ struct smb3_key_debug_info keys_info; |
| 308 | ++ uint8_t *psess_id; |
| 309 | ++ |
| 310 | ++ if (ioctl(f, CIFS_DUMP_KEY, &keys_info) < 0) { |
| 311 | ++ fprintf(stderr, "Querying keys information failed with %s\n", strerror(errno)); |
| 312 | ++ exit(1); |
| 313 | ++ } |
| 314 | ++ |
| 315 | ++ if (keys_info.cipher_type == 1) |
| 316 | ++ printf("CCM encryption"); |
| 317 | ++ else if (keys_info.cipher_type == 2) |
| 318 | ++ printf("GCM encryption"); |
| 319 | ++ else if (keys_info.cipher_type == 0) |
| 320 | ++ printf("SMB3.0 CCM encryption"); |
| 321 | ++ else |
| 322 | ++ printf("unknown encryption type"); |
| 323 | ++ |
| 324 | ++ printf("\nSession Id: "); |
| 325 | ++ psess_id = (uint8_t *)&keys_info.Suid; |
| 326 | ++ for (int i = 0; i < 8; i++) |
| 327 | ++ printf(" %02x", psess_id[i]); |
| 328 | ++ |
| 329 | ++ printf("\nSession Key: "); |
| 330 | ++ for (int i = 0; i < 16; i++) |
| 331 | ++ printf(" %02x", keys_info.auth_key[i]); |
| 332 | ++ printf("\nServer Encryption Key: "); |
| 333 | ++ for (int i = 0; i < SMB3_SIGN_KEY_SIZE; i++) |
| 334 | ++ printf(" %02x", keys_info.smb3encryptionkey[i]); |
| 335 | ++ printf("\nServer Decryption Key: "); |
| 336 | ++ for (int i = 0; i < SMB3_SIGN_KEY_SIZE; i++) |
| 337 | ++ printf(" %02x", keys_info.smb3decryptionkey[i]); |
| 338 | ++ printf("\n"); |
| 339 | ++} |
| 340 | ++ |
| 341 | + #define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array) |
| 342 | + |
| 343 | + #define MIN_SNAPSHOT_ARRAY_SIZE 16 /* See MS-SMB2 section 3.3.5.15.1 */ |
| 344 | +@@ -1189,6 +1238,8 @@ int main(int argc, char *argv[]) |
| 345 | + quota(f); |
| 346 | + else if (!strcmp(argv[optind], "secdesc")) |
| 347 | + secdesc(f); |
| 348 | ++ else if (!strcmp(argv[optind], "keys")) |
| 349 | ++ dump_keys(f); |
| 350 | + else { |
| 351 | + fprintf(stderr, "Unknown command %s\n", argv[optind]); |
| 352 | + exit(1); |
| 353 | +-- |
| 354 | +2.17.1 |
| 355 | + |
| 356 | diff --git a/debian/patches/0005-smbinfo-Add-SETCOMPRESSION-support.patch b/debian/patches/0005-smbinfo-Add-SETCOMPRESSION-support.patch |
| 357 | new file mode 100644 |
| 358 | index 0000000..7068b53 |
| 359 | --- /dev/null |
| 360 | +++ b/debian/patches/0005-smbinfo-Add-SETCOMPRESSION-support.patch |
| 361 | @@ -0,0 +1,119 @@ |
| 362 | +From 07c5812c062ac584511f244f91fcdfd5d08c8b68 Mon Sep 17 00:00:00 2001 |
| 363 | +From: Ronnie Sahlberg <lsahlber@redhat.com> |
| 364 | +Origin: Upstream, https://git.samba.org/?p=cifs-utils.git;a=commit;h=07c5812c062ac584511f244f91fcdfd5d08c8b68 |
| 365 | +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1886551 |
| 366 | +Date: Fri, 4 Oct 2019 09:29:02 +1000 |
| 367 | +Subject: [PATCH] smbinfo: Add SETCOMPRESSION support |
| 368 | + |
| 369 | +Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> |
| 370 | +--- |
| 371 | + smbinfo.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- |
| 372 | + smbinfo.rst | 2 ++ |
| 373 | + 2 files changed, 49 insertions(+), 1 deletion(-) |
| 374 | + |
| 375 | +diff --git a/smbinfo.c b/smbinfo.c |
| 376 | +index 2aa5eee..636f1bd 100644 |
| 377 | +--- a/smbinfo.c |
| 378 | ++++ b/smbinfo.c |
| 379 | +@@ -101,6 +101,8 @@ usage(char *name) |
| 380 | + " Prints the objectid of the file and GUID of the underlying volume.\n" |
| 381 | + " getcompression:\n" |
| 382 | + " Prints the compression setting for the file.\n" |
| 383 | ++ " setcompression <no|default|lznt1>:\n" |
| 384 | ++ " Sets the compression level for the file.\n" |
| 385 | + " list-snapshots:\n" |
| 386 | + " List the previous versions of the volume that backs this file.\n" |
| 387 | + " quota:\n" |
| 388 | +@@ -310,6 +312,30 @@ getcompression(int f) |
| 389 | + free(qi); |
| 390 | + } |
| 391 | + |
| 392 | ++static void |
| 393 | ++setcompression(int f, uint16_t level) |
| 394 | ++{ |
| 395 | ++ struct smb_query_info *qi; |
| 396 | ++ |
| 397 | ++ qi = malloc(sizeof(struct smb_query_info) + 2); |
| 398 | ++ memset(qi, 0, sizeof(qi) + 2); |
| 399 | ++ qi->info_type = 0x9c040; |
| 400 | ++ qi->file_info_class = 0; |
| 401 | ++ qi->additional_information = 0; |
| 402 | ++ qi->output_buffer_length = 2; |
| 403 | ++ qi->flags = PASSTHRU_FSCTL; |
| 404 | ++ |
| 405 | ++ level = htole16(level); |
| 406 | ++ memcpy(&qi[1], &level, 2); |
| 407 | ++ |
| 408 | ++ if (ioctl(f, CIFS_QUERY_INFO, qi) < 0) { |
| 409 | ++ fprintf(stderr, "ioctl failed with %s\n", strerror(errno)); |
| 410 | ++ exit(1); |
| 411 | ++ } |
| 412 | ++ |
| 413 | ++ free(qi); |
| 414 | ++} |
| 415 | ++ |
| 416 | + static void |
| 417 | + print_fileaccessinfo(uint8_t *sd, int type) |
| 418 | + { |
| 419 | +@@ -1175,17 +1201,35 @@ list_snapshots(int f) |
| 420 | + free(buf); |
| 421 | + } |
| 422 | + |
| 423 | ++static int |
| 424 | ++parse_compression(const char *arg) |
| 425 | ++{ |
| 426 | ++ if (!strcmp(arg, "no")) |
| 427 | ++ return 0; |
| 428 | ++ else if (!strcmp(arg, "default")) |
| 429 | ++ return 1; |
| 430 | ++ else if (!strcmp(arg, "lznt1")) |
| 431 | ++ return 2; |
| 432 | ++ |
| 433 | ++ fprintf(stderr, "compression must be no|default|lznt1\n"); |
| 434 | ++ exit(10); |
| 435 | ++} |
| 436 | ++ |
| 437 | + int main(int argc, char *argv[]) |
| 438 | + { |
| 439 | + int c; |
| 440 | + int f; |
| 441 | ++ int compression = 1; |
| 442 | + |
| 443 | + if (argc < 2) { |
| 444 | + short_usage(argv[0]); |
| 445 | + } |
| 446 | + |
| 447 | +- while ((c = getopt_long(argc, argv, "vVh", NULL, NULL)) != -1) { |
| 448 | ++ while ((c = getopt_long(argc, argv, "c:vVh", NULL, NULL)) != -1) { |
| 449 | + switch (c) { |
| 450 | ++ case 'c': |
| 451 | ++ compression = parse_compression(optarg); |
| 452 | ++ break; |
| 453 | + case 'v': |
| 454 | + printf("smbinfo version %s\n", VERSION); |
| 455 | + return 0; |
| 456 | +@@ -1232,6 +1276,8 @@ int main(int argc, char *argv[]) |
| 457 | + fsctlgetobjid(f); |
| 458 | + else if (!strcmp(argv[optind], "getcompression")) |
| 459 | + getcompression(f); |
| 460 | ++ else if (!strcmp(argv[optind], "setcompression")) |
| 461 | ++ setcompression(f, compression); |
| 462 | + else if (!strcmp(argv[optind], "list-snapshots")) |
| 463 | + list_snapshots(f); |
| 464 | + else if (!strcmp(argv[optind], "quota")) |
| 465 | +diff --git a/smbinfo.rst b/smbinfo.rst |
| 466 | +index 500ce0e..c8f76e6 100644 |
| 467 | +--- a/smbinfo.rst |
| 468 | ++++ b/smbinfo.rst |
| 469 | +@@ -69,6 +69,8 @@ COMMAND |
| 470 | + |
| 471 | + `getcompression`: Prints the compression setting for the file. |
| 472 | + |
| 473 | ++`setcompression -c <no|default|lznt1>`: Sets the compression setting for the file. |
| 474 | ++ |
| 475 | + `list-snapshots`: Lists the previous versions of the volume that backs this file |
| 476 | + |
| 477 | + `quota`: Print the quota for the volume in the form |
| 478 | +-- |
| 479 | +2.17.1 |
| 480 | + |
| 481 | diff --git a/debian/patches/0006-smbinfo.rst-document-new-keys-command.patch b/debian/patches/0006-smbinfo.rst-document-new-keys-command.patch |
| 482 | new file mode 100644 |
| 483 | index 0000000..cfe48d5 |
| 484 | --- /dev/null |
| 485 | +++ b/debian/patches/0006-smbinfo.rst-document-new-keys-command.patch |
| 486 | @@ -0,0 +1,30 @@ |
| 487 | +From 74a1ced5f706ea6a9cab885693c7755657b81a2a Mon Sep 17 00:00:00 2001 |
| 488 | +From: Aurelien Aptel <aaptel@suse.com> |
| 489 | +Origin: Upstream, https://git.samba.org/?p=cifs-utils.git;a=commit;h=74a1ced5f706ea6a9cab885693c7755657b81a2a |
| 490 | +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1886551 |
| 491 | +Date: Mon, 14 Oct 2019 19:06:25 +0200 |
| 492 | +Subject: [PATCH] smbinfo.rst: document new `keys` command |
| 493 | + |
| 494 | +Signed-off-by: Aurelien Aptel <aaptel@suse.com> |
| 495 | +--- |
| 496 | + smbinfo.rst | 4 ++++ |
| 497 | + 1 file changed, 4 insertions(+) |
| 498 | + |
| 499 | +diff --git a/smbinfo.rst b/smbinfo.rst |
| 500 | +index c8f76e6..7413849 100644 |
| 501 | +--- a/smbinfo.rst |
| 502 | ++++ b/smbinfo.rst |
| 503 | +@@ -90,6 +90,10 @@ COMMAND |
| 504 | + - File types |
| 505 | + - File flags |
| 506 | + |
| 507 | ++`keys`: Dump session id, encryption keys and decryption keys so that |
| 508 | ++the SMB3 traffic of this mount can be decryped e.g. via wireshark |
| 509 | ++(requires root). |
| 510 | ++ |
| 511 | + ***** |
| 512 | + NOTES |
| 513 | + ***** |
| 514 | +-- |
| 515 | +2.17.1 |
| 516 | + |
| 517 | diff --git a/debian/patches/series b/debian/patches/series |
| 518 | index 994cf2f..2cbd9c1 100644 |
| 519 | --- a/debian/patches/series |
| 520 | +++ b/debian/patches/series |
| 521 | @@ -1 +1,6 @@ |
| 522 | 0001-Fix-fPIE-casing.patch |
| 523 | +0002-smbinfo-Improve-help-usage-and-add-h-option.patch |
| 524 | +0003-smbinfo-add-GETCOMPRESSION-support.patch |
| 525 | +0004-smbinfo-print-the-security-information-needed-to-dec.patch |
| 526 | +0005-smbinfo-Add-SETCOMPRESSION-support.patch |
| 527 | +0006-smbinfo.rst-document-new-keys-command.patch |

First pass, still looking.