File: smbfs.mojom

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (166 lines) | stat: -rw-r--r-- 4,933 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module smbfs.mojom;

import "chromeos/ash/components/smbfs/mojom/file_path.mojom";
import "chromeos/ash/components/smbfs/mojom/ip_address.mojom";

// This file is shared between Chrome and Chrome OS.
// In Chrome, this file is located at:
// //chromeos/ash/components/smbfs/mojom/smbfs.mojom
// In Chrome OS, this file is located at:
// //platform2/smbfs/mojom/smbfs.mojom

// Name used to identify the bootstrap message pipe. To be used with
// mojo::{Incoming,Outgoing}Invitation.
const string kBootstrapPipeName = "smbfs-bootstrap";

// Implemented by SmbFs, used from Chrome.
interface SmbFsBootstrap {
  // Connect to an SMB share. This method must only be called once.
  MountShare(MountOptions options, pending_remote<SmbFsDelegate> delegate) =>
      (MountError error, pending_remote<SmbFs>? smbfs);
};

// Implemented by SmbFs, used from Chrome.
interface SmbFs {
  // Deletes any credentials stored for this share mount.
  RemoveSavedCredentials() => (bool success);

  // Recursively delete |path|, which is the absolute path (within the SMB
  // share, ie. /dir_a/file_b) of a file or directory.
  DeleteRecursively(FilePath path) => (DeleteRecursivelyError error);
};

// Implemented by Chrome, used from SmbFs.
interface SmbFsDelegate {
  // Request authentication credentials. This request is made when accessing a
  // share fails with an authentication error. If null is returned, this
  // indicates the request was dismissed by the user.
  RequestCredentials() => (Credentials? credentials);
};

enum MountError {
  // Success.
  kOk = 0,

  // Generic code for uncategorized errors.
  kUnknown = 1,

  // Mount timeout.
  kTimeout = 2,

  // Share URL is invalid.
  kInvalidUrl = 3,

  // An invalid combination of mount options was specified, or required
  // options were missing.
  kInvalidOptions = 4,

  // Share not found.
  kNotFound = 5,

  // Share access denied (i.e. username/password error).
  kAccessDenied = 6,

  // Invalid protocol (i.e. SMB1).
  kInvalidProtocol = 7,
};

enum DeleteRecursivelyError {
  // Success.
  kOk = 0,

  // Generic code for uncategorized errors.
  kUnknown = 1,

  // The specified path for deletion was not found.
  kPathNotFound = 2,

  // A file or directory within the tree could not be deleted.
  kFailedToDeleteNode = 3,

  // A directory within the tree could not be listed.
  kFailedToListDirectory = 4,

  // A recursive delete is already in progress.
  kOperationInProgress = 5,
};

struct Password {
  // The Samba client library uses an "fstring" type to obtain the password,
  // which is limited to 256 bytes (See source3/include/includes.h in the Samba
  // sources). Subtract one to account for a null terminator.
  const int32 kMaxLength = 255;

  // File descriptor of pipe containing password.
  handle fd;
  // Length of password stored in |fd|.
  int32 length;
};

struct KerberosConfig {
  enum Source {
    // Obtain credentials for Active Directory from authpolicyd.
    kActiveDirectory = 0,

    // Obtain credentials from kerberosd.
    kKerberos = 1,
  };
  // Source of kerberos credentials.
  Source source;

  // Kerberos identity. Will be account GUID for Active Directory, and
  // principal name for non-AD kerberos.
  string identity;
};

struct CredentialStorageOptions {
  const int32 kMinSaltLength = 16;

  // Username hash of the mounting profile.
  string account_hash;

  // A vector of random bytes to use to obfuscate the password being stored.
  // Must be at least |kMinSaltLength| bytes in length and generated by a
  // strong random byte generator.
  array<uint8> salt;
};

struct MountOptions {
  // Full share path. Must be in the form "smb://hostname/sharename", and must
  // have the hostname as entered by the user and NOT resolved to an IP address
  // (unless the user entered an IP address as the hostname).
  string share_path;

  // Resolved IP address of the share's hostname.
  IPAddress? resolved_host;

  // Authentication parameters.
  string username;
  string workgroup;
  // Password is passed using an fd to avoid having the password in addressable
  // memory while being transferred over IPC. This also allows the password to
  // be stored using libpasswordprovider on the Chrome OS side.
  Password? password;
  KerberosConfig? kerberos_config;

  // Allow NTLM authentication.
  bool allow_ntlm = false;

  // Skip attempting to connect to the share, and instead unconditionally mount
  // the share.
  bool skip_connect = false;

  // Options for saving password to the daemon store. If present, the password
  // will be saved or restored based on whether the |password| field is present.
  [MinVersion=1] CredentialStorageOptions? credential_storage_options;
};

struct Credentials {
  string username;
  string workgroup;
  Password? password;
};