@@ -26,7 +26,7 @@ struct JsonPasswd {
26
26
}
27
27
28
28
impl JsonPasswd {
29
- pub fn to_nss ( self ) -> Passwd {
29
+ pub fn into_nss ( self ) -> Passwd {
30
30
Passwd {
31
31
name : self . name ,
32
32
passwd : self . passwd . unwrap_or ( "*" . to_string ( ) ) ,
@@ -60,7 +60,7 @@ struct JsonGroup {
60
60
}
61
61
62
62
impl JsonGroup {
63
- pub fn to_nss ( self ) -> Group {
63
+ pub fn into_nss ( self ) -> Group {
64
64
Group {
65
65
name : self . name ,
66
66
passwd : self . passwd . unwrap_or ( "*" . to_string ( ) ) ,
@@ -101,7 +101,7 @@ impl PasswdHooks for JsonFilePasswd {
101
101
Err ( _) => return Response :: Unavail ,
102
102
Ok ( v) => v,
103
103
} ;
104
- let r = v. into_iter ( ) . map ( |u| u. to_nss ( ) ) . collect ( ) ;
104
+ let r = v. into_iter ( ) . map ( |u| u. into_nss ( ) ) . collect ( ) ;
105
105
Response :: Success ( r)
106
106
}
107
107
@@ -112,7 +112,7 @@ impl PasswdHooks for JsonFilePasswd {
112
112
} ;
113
113
match v. into_iter ( ) . find ( |u| u. uid == uid) {
114
114
None => Response :: NotFound ,
115
- Some ( u) => Response :: Success ( u. to_nss ( ) ) ,
115
+ Some ( u) => Response :: Success ( u. into_nss ( ) ) ,
116
116
}
117
117
}
118
118
@@ -123,7 +123,7 @@ impl PasswdHooks for JsonFilePasswd {
123
123
} ;
124
124
match v. into_iter ( ) . find ( |u| u. name == name) {
125
125
None => Response :: NotFound ,
126
- Some ( u) => Response :: Success ( u. to_nss ( ) ) ,
126
+ Some ( u) => Response :: Success ( u. into_nss ( ) ) ,
127
127
}
128
128
}
129
129
}
@@ -137,7 +137,7 @@ impl GroupHooks for JsonFileGroup {
137
137
Err ( _) => return Response :: Unavail ,
138
138
Ok ( v) => v,
139
139
} ;
140
- let r = v. into_iter ( ) . map ( |g| g. to_nss ( ) ) . collect ( ) ;
140
+ let r = v. into_iter ( ) . map ( |g| g. into_nss ( ) ) . collect ( ) ;
141
141
Response :: Success ( r)
142
142
}
143
143
@@ -148,7 +148,7 @@ impl GroupHooks for JsonFileGroup {
148
148
} ;
149
149
match v. into_iter ( ) . find ( |g| g. gid == gid) {
150
150
None => Response :: NotFound ,
151
- Some ( g) => Response :: Success ( g. to_nss ( ) ) ,
151
+ Some ( g) => Response :: Success ( g. into_nss ( ) ) ,
152
152
}
153
153
}
154
154
@@ -159,7 +159,7 @@ impl GroupHooks for JsonFileGroup {
159
159
} ;
160
160
match v. into_iter ( ) . find ( |g| g. name == name) {
161
161
None => Response :: NotFound ,
162
- Some ( g) => Response :: Success ( g. to_nss ( ) ) ,
162
+ Some ( g) => Response :: Success ( g. into_nss ( ) ) ,
163
163
}
164
164
}
165
165
}
@@ -175,7 +175,7 @@ impl InitgroupsHooks for JsonFileInitgroups {
175
175
let groups_by_members = v
176
176
. into_iter ( )
177
177
. filter ( |g| g. members . as_ref ( ) . filter ( |m| m. contains ( & name) ) . is_some ( ) )
178
- . map ( |g| g. to_nss ( ) ) ;
178
+ . map ( |g| g. into_nss ( ) ) ;
179
179
180
180
let passwd = match load_passwd ( ) {
181
181
Err ( _) => return Response :: Unavail ,
@@ -186,7 +186,7 @@ impl InitgroupsHooks for JsonFileInitgroups {
186
186
Some ( u) => u,
187
187
} ;
188
188
let groups_by_passwd = u. groups . unwrap_or_default ( ) . into_iter ( ) . map ( |gid| Group {
189
- gid : gid ,
189
+ gid,
190
190
// Following fields is not used in initgroups
191
191
name : "" . to_string ( ) ,
192
192
passwd : "" . to_string ( ) ,
0 commit comments