5.19 File Security-Guard Checks

► |  | The Racket Foreign Interface

1 | Overview
2 | Loading Foreign Libraries
3 | C Types
4 | Pointer Functions
5 | Derived Utilities
6 | Miscellaneous Support
7 | Unexported Primitive Functions
| Bibliography
| Index

▼ | 5 | Derived Utilities

5.1 | Safe Homogenous Vectors
5.2 | Safe C Vectors
5.3 | Tagged C Pointer Types
5.4 | Serializable C Struct Types
5.5 | Static Callout and Callback Cores
5.6 | Defining Bindings
5.7 | Allocation and Finalization
5.8 | Custodian Shutdown Registration
5.9 | Atomic Execution
5.10 | Speculatively Atomic Execution
5.11 | Thread Scheduling
5.12 | Ports
5.13 | Process-Wide and Place-Wide Registration
5.14 | Operating System Threads
5.15 | Garbage Collection Callbacks
5.16 | Objective-C FFI
5.17 | Cocoa Foundation
5.18 | COM (Common Object Model)
5.19 | File Security-Guard Checks
5.20 | Windows API Helpers
5.21 | Virtual Machine Primitives

On this page:

security-guard-check-file
_ file/ guard
_ file/ r
_ file/ rw
security-guard-check-file-link
security-guard-check-network

top contents ← prev up next →

### 5.19 File Security-Guard Checks🔗ℹ

(require ffi/file) | package: base

> procedure (security-guard-check-file who path perms) → void?
> who : symbol?
> path : path-string?
> perms : (listof (or/c 'read 'write 'execute 'delete 'exists))

Checks whether (current-security-guard) permits access to the file specified by path with the permissions perms. See make-security-guard for more information on perms.

The symbol who should be the name of the function on whose behalf the security check is performed; it is passed to the security guard to use in access-denied errors.

> procedure (_file/guard perms [who]) → ctype?
> perms : (listof (or/c 'read 'write 'execute 'delete 'exists))
> who : symbol? = '_file/guard

Like _file and _path, but conversion from Racket to C first completes the path using path->complete-path then cleanses it using cleanse-path, then checks that the current security guard grants access on the resulting complete path with perms. As an output value, identical to _path.

> value _file/r : ctype?
> value _file/rw : ctype?

Equivalent to (_file/guard '(read) '_file/r) and (_file/guard '(read write) '_file/rw), respectively.

> > procedure
> > (security-guard-check-file-link |  | who |  |  |  |
> > |  | path |  |  |  |
> > |  | dest) |  | → |  | void?
> who : symbol?
> path : path-string?
> dest : path-string?

Checks whether (current-security-guard) permits link creation of path as a link dest. The symbol who is the same as for security-guard-check-file.

Added in version 6.9.0.5 of package base.

> > procedure
> > (security-guard-check-network |  | who |  |  |  |
> > |  | host |  |  |  |
> > |  | port |  |  |  |
> > |  | mode) |  | → |  | void?
> who : symbol?
> host : (or/c string? #f)
> port : (or/c (integer-in 1 65535) #f)
> mode : (or/c 'client 'server)

Checks whether (current-security-guard) permits network access at host and port in server or client mode as specified by mode. The symbol who is the same as for security-guard-check-file.

Added in version 6.9.0.5 of package base.

top contents ← prev up next →